On Jan 5, 2007, at 3:56 PM, Trans wrote:
> The operator you suggest however would probably have to be flipped to
> avoid ambiguity with Symbol#@-. Eg. recv < -:class (I know rare. but
> possible).

The mnemonics are all wrong if you flip it:

	obj <- message		# sending the message to the object
	obj -> message		# sending the object to the message?

You have to think of <- as a two character operator.  Of course
the parser would also have to think of it that way.  There would have to
be some white space to have it parse as '<' and '-' separately.  My only
point is that it can be parsed, but a syntax that was a bit more
stable with respect to white space would certainly be better.

> As for the class search idea, that can be done easily enough with:
>
>   recv.as(BasicObject) -> :class

This introduces the same problem I pointed out with respect to the
semantics of #send but this time with #as.  In fact it is worse because
you've got normal method call syntax but completely different semantics
since
   recv.as(BasicObject)
will parse as an expression to be evaluated as the lhs of the '->'  
operator.
What kind of object would #as return and how would the -> operator know
about the receiver?

> To outline, this would give ruby a complete set of dispatch operators:
>
>   .        literal
>   <-      dynamic
>   <<-      functional (dynamic)
>   <~       pervasive (dynamic)

Having a syntax for starting method lookup in a particular class also
gives you a way to call a method that has been redefined without having
to play games with aliases:

class A; def m; end; end
class B < A; def m; end; end

class C
   def example
      self.m		# calls B#m
      (self, A) <- :m	# calls A#m  (kind of ugly syntax though)
   end
end


Gary Wright