From: Eric Mahurin Date: 2008-04-24T22:26:20+09:00 Subject: Re: [RCR] Drop :: as a . synonym ------=_Part_14471_23490942.1209043578224 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: > > On Wed, Apr 23, 2008 at 9:21 AM, David A. Black > > wrote: > > > > Hi -- > > > > I'd like to request the deprecation/removal of :: as a synonym for > the > > method-calling dot. I think it's a good opportunity to take out > > something that Ruby doesn't need. We've already got the dot, which > > always means "send a message", and :: already means something else > > (constant resolution). > > > > > > 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)? > > And how about this inconsistency: > > a.b <=> a.b() > > a::b a::b() I'm not sure why this is a problem, but with the currying part of what I was proposing, a::b and a::b() would be the same. Currying x with no arguments could be just x. In this respect, I like the current behaviour much more, which is less > inconsistent. > > And think about this usage scenario, which is where "::" really helps to > mask dynamic class generation: > > module A > class X > C = 1 > end > > def self.GenClass(*args) > Class.new(X) # do something here > end > end > > A::X > A::X::C > A::GenClass(1, 2, 3) > A::GenClass(1, 2, 3)::C > > Basically you can treat a method that returns a new class like a class, > which is beautiful. Like David said, why not just A.GenClass(1, 2, 3)::C ? I guess what I was suggesting would just compliment what David is asking. David, from your initial message, I thought you wanted to drop "::" altogether and alias its functionality with ".". I guess I misinterpreted. I think you are asking for non-overlapping functionality of "::" and ".", which I agree with. Eric ------=_Part_14471_23490942.1209043578224 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:
> On Wed, Apr 23, 2008 at 9:21 AM, David A. Black <dblack@rubypal.com
> <mailto:dblack@rubypal.com>> wrote:
>
>     Hi --
>
>     I'd like to request the deprecation/removal of :: as a synonym for the
>     method-calling dot. I think it's a good opportunity to take out
>     something that Ruby doesn't need. We've already got the dot, which
>     always means "send a message", and :: already means something else
>     (constant resolution).
>
>
> 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)?

And how about this inconsistency:

 a.b  <=>  a.b()

 a::b <!=> a::b()

I'm not sure why this is a problem, but with the currying part of what I was proposing, a::b and a::b() would be the same.  Currying x with no arguments could be just x.

In this respect, I like the current behaviour much more, which is less
inconsistent.

And think about this usage scenario, which is where "::" really helps to
mask dynamic class generation:

 module A
   class X
     C = 1
   end

   def self.GenClass(*args)
     Class.new(X) # do something here
   end
 end

 A::X
 A::X::C
 A::GenClass(1, 2, 3)
 A::GenClass(1, 2, 3)::C

Basically you can treat a method that returns a new class like a class,
which is beautiful.


Like David said, why not just A.GenClass(1, 2, 3)::C ?

I guess what I was suggesting would just compliment what David is asking.  David, from your initial message, I thought you wanted to drop "::" altogether and alias its functionality with ".".  I guess I misinterpreted.  I think you are asking for non-overlapping functionality of "::" and ".", which I agree with.

Eric

------=_Part_14471_23490942.1209043578224--