On Wed, 23 Mar 2005, Yukihiro Matsumoto wrote:

> I want some syntactical support if cascading method call have to be
> introduced, not by a method (except for instance_eval, of course).

Unlike Perl, Ruby requires a space between a $-prefix and a variable
name. Therefore a standalone $ could be an operator in Ruby. There seems
to be a tacit tradition of treating $ as a slashed S letter, and using it
as an abbreviation for a word starting with S. For example:

Basic:   it's $ as in String
Sh,Tcl:  it's $ as in Substitute (interpolate)
Perl:    it's $ as in Scalar
Ruby(a): it's $ as in Special (think-of *special-variables*)

and then

Ruby(b): it's $ as in Sequence (of method calls)

it wouldn't be that confusing because $-vars are rarely used in Ruby.

I often name ";" (and "\n") the sequence operator already, but this would
be a second flavour:

A && B     run A and if true then run B
A || B     run A and if false then run B
A ; B      run A and then B no matter what

... are three operators on expressions, but in A $ B, the B part obviously
wouldn't be an expression, and even A would be restricted to being a
method-call expression. I assume the binding will be rather low-precedence
(mimicking Smalltalk's precedence could be a good idea). B is restricted
to being a receiver-less method-call in which the receiver will be A's
receiver instead of being the default self.

Any other ideas for the meaning of $ here? Any other characters? (I'd
rather *not* use backslash)

If people have violent allergic reactions to the use of "$" for *that*,
then I'd suggest "&." instead, even though it's longer.

Another idea I've had is that, because prefix "." is not allowed in Ruby
1.8, it could later serve so that in "a.foo;.bar" the dot-prefix operator
would make the method-call on the "syntactically previous" receiver, that
is, a. How "previous" is defined may depend on precedence rules...

What do you think of this?

_____________________________________________________________________
Mathieu Bouchard -=- MontrñÂl QC Canada -=- http://artengine.ca/matju