From: Eric Mahurin Date: 2008-04-24T23:00:59+09:00 Subject: Re: [RCR] Drop :: as a . synonym ------=_Part_32_16157240.1209045657607 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 4/24/08, Michael Neumann wrote: > > Eric Mahurin wrote: > > I'd actually prefer to go the other way and add more value to both > > "::" and ".". > > > > a::b - gives an object named b in the scope of a > > a.b - calls an object named b in the scope of a > > Nice idea, but a::b::c doesn't make any sense, right? Or is it method > "c" of the Proc object method(:b)? Yep. So, a::b::arity would probably be a better example. A chain of these "::" would typically have uppercase constants that could be arbitrary objects (typically class/module) for all except the last that would refer to a method. The first in a chain might also be lowercase (or an expression) if it is a class/module. A possibly even better idea would be to have "::" as an overloadable operator. Then you could make objects that look like classes or modules with a scope of "constants". You could also make "." follow this overloading (call the object from the "::" operator). I know some of you might be seeing the similarity to python. You can do similar things with its overloadable "." operator (attribute accessor) and overloable "()" operator (call). The above would give you something similar in a ruby syntax. I still think it would be nice to have an overloadable call operator like python, so you don't have to #call a Proc/Method. Or allow #[] to take a block like a normal method call (#[] would be just as good then). ------=_Part_32_16157240.1209045657607 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 4/24/08, Michael Neumann <mneumann@ntecs.de> wrote:
Eric Mahurin wrote:
> I'd actually prefer to go the other way and  add  more value to both
> "::" and ".".
>
> a::b - gives an object named b in the scope of a
> a.b - calls an object named b in the scope of a

Nice idea, but a::b::c doesn't make any sense, right? Or is it method
"c" of the Proc object method(:b)?

Yep.  So, a::b::arity would probably be a better example.  A chain of these "::" would typically have uppercase constants that could be arbitrary objects (typically class/module) for all except the last that would refer to a method.  The first in a chain might also be lowercase (or an expression) if it is a class/module.

A possibly even better idea would be to have "::" as an overloadable operator.  Then you could make objects that look like classes or modules with a scope of "constants".  You could also make "." follow this overloading (call the object from the "::" operator).

I know some of you might be seeing the similarity to python.  You can do similar things with its overloadable "." operator (attribute accessor) and overloable "()" operator (call).  The above would give you something similar in a ruby syntax.  I still think it would be nice to have an overloadable call operator like python, so you don't have to #call a Proc/Method.  Or allow #[] to take a block like a normal method call (#[] would be just as good then).

------=_Part_32_16157240.1209045657607--