List Info

Thread: Re: Drop :: as a . synonym




Re: Drop :: as a . synonym
country flaguser name
United States
2008-04-23 10:04:15
Hi --

On Wed, 23 Apr 2008, Charles Oliver Nutter wrote:

> 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).
>> 
>> My view is that if it weren't already there, it
would never occur to
>> anyone to put it in at this point. Of course, it
*is* already there,
>> but I think it would be well worth taking it out.
In my 7.5 years of
>> Ruby programming I've never seen it demonstrate any
usefulness at all.
>
> In JRuby we use it to allow a single delimiter for
package elements when 
> referring to a Java class.
>
> Given the Java class java.lang.System, you can access
it as 
> "java.lang.System", in which the intermediate
"java" and "javalang" modules 
> are accessed with dots and the "System" at
the end is a method that returns 
> the class, or you can access it as
"java::lang::System", where the :: 
> replaces the . for method calls and the
"System" at the end is a direct 
> constant reference. You can't do this without :: being
available for method 
> calls.

OK... but could you do something else?  I don't
mean that
facetiously; I'm just not sure that having two ways to get
at the Java
class is worth having all the extra ::'s throughout so much
Ruby code.
But I don't know enough about the problem to know how it
might have
played out if . and :: had been fully differentiated in
Ruby.


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           bond (Skills
Matter)
See http://www.rubypal.com for
details and updates!


Re: Drop :: as a . synonym
country flaguser name
United States
2008-04-23 14:11:59
David A. Black wrote:
> OK... but could you do something else?  I don't
mean that
> facetiously; I'm just not sure that having two ways to
get at the Java
> class is worth having all the extra ::'s throughout so
much Ruby code.
> But I don't know enough about the problem to know how
it might have
> played out if . and :: had been fully differentiated in
Ruby.

You can't do this with dots:

class java::lang::System
end

- Charlie


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )