On Thu, Apr 24, 2008 at 05:28:39AM +0900, Eric Mahurin wrote:
> 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 REALLY like this idea, with a few exceptions:

1) You haven't specified what happens in this case:

  class A
    B = 42
    def self.B; 43; end
  end
  p A::B

(currently A::B returns the constant B in class A and A::B() is
equivalent to A.B())

2) Conceptually constants exist in the class/module while singleton
   methods exist as instance methods of the class/module's singleton
   class.  For example:

   class Foo
     SomeConstant = 42
     def self.some_method; 42; end
   end
   p Foo::SomeConstant # lookup happens in Foo
   p Foo::some_method  # lookup happens in Foo's singleton class

   Thus we have the illusion of unification of constant and method
   lookup without actually getting it.

3) This change breaks code without providing a transition path.  If the
   :: sytax were to be temporarily deprecated for methods, it would be
   years (ruby 2.0, most likely) before we would actually see this
   change.  Perhaps we could use a different operator instead?

> currying could also naturally come out of this:
> 
> a::b(x, y) <=> a.method(:b).curry(x, y)
> a::b(x, y)[z] <=> a.method(:b).curry(x, y)[z] <=> a.b

Why do you find #curry to be a more natural meaning for () than #call?

Paul