From: Michael Neumann Date: 2008-04-25T03:56:50+09:00 Subject: Re: [RCR] Drop :: as a . synonym David A. Black wrote: > Hi -- > > On Thu, 24 Apr 2008, 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). >>> >> >> 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. > > But why have a second method-calling operator, if the first one will > work? (A.GenClass(1,2,3)::C). Also, all of the use-cases we've seen in > response to my RCR seem to involve some rather specialized > class/method interplay. I'm still not convinced that having :: as a > superset of . isn't a very loose fit for the language. Personally I prefer A::GenClass(1,2,3)::C over A.GenClass(1,2,3)::C Here "GenClass" should be seen as a "dynamic class", something in-between a class (constant) and a method :) Regards, Michael