From: Stefan Lang Date: 2008-04-24T20:28:26+09:00 Subject: Re: [RCR] Drop :: as a . synonym On Mittwoch, 23. April 2008, 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 > > With this, you'd have these as equivalents: > > a::b <=> a.method(:b) > a.b <=> a::b.call > a.b(x, y) <=> a::b.call(x, y) I don't think this is a good idea for Ruby. The implications are too far reaching. It would turn Ruby from being message- oriented to Python's attribute lookup + function call semantics. First of all, if these semantics were actually adopted, your equivalence table wouldn't work. There's an infinite recursion in each line. Second, not every "message send" in Ruby is equivalent to a.method(:b).call. Think of method_missing. Furthermore, I think most uses of a.method(:b) should actually be replaced with lambda { a.b }, since it respects Ruby's message passing nature (method_missing, again). So I'd rather have a shorter way to say lambda { |*args, &block| a.b(*args, &block) } Stefan