Hi Matz --

On Thu, 24 Apr 2008, Yukihiro Matsumoto wrote:

> Hi,
>
> In message "Re: [RCR] Drop :: as a . synonym"
>    on Thu, 24 Apr 2008 22:48:37 +0900, "David A. Black" <dblack / rubypal.com> writes:
>
> |I do think it's -- well, maybe not silly, but loose and pointless (ha
> |ha, 'point'less) -- that 'baz'::capitalize is the same as
> |'baz'.capitalize. At the very least it's casting an awfully wide net
> |if the goal is actually to have some special-cased treatment of
> |methods that start with capital letters. But we still haven't heard
> |from Matz on what the goal was for having two method-senders.
>
> The "::" for method invocation is a clue to emphasize class methods,
> which are often treated specially in other programming languages.  In
> Ruby, they are mere methods of mere objects.  But sometimes it might
> be useful to treat class methods special to improve readability.

It doesn't improve readability, though.  This is completely readable:

   File.new

If someone doesn't understand that File is an object, then obviously
they have to learn about classes being objects (if they want to
understand the language at all). Once they see that File is an object,
and that .new sends the message "new", the notation is completely
clear, and :: cannot make it more clear.

People can learn to read "File::new", and they can wonder why it
exists. If it's really because other languages treat class methods
specially, maybe they should find that out by studying those other
languages :-) I tend to feel that the "mere methods of mere objects"
principle is more central here.

I guess my view is that the unified model that Ruby represents, where
classes are objects and objects receive messages, should eliminate any
need to have a special-case notation for class methods -- and, of
course, the other issue is that :: isn't a special-case notation.


David

-- 
Rails training from David A. Black and Ruby Power and Light:
   INTRO TO RAILS         June 9-12            Berlin
   ADVANCING WITH RAILS   June 16-19           Berlin
   INTRO TO RAILS         June 24-27           London (Skills Matter)
See http://www.rubypal.com for details and updates!