On 4/3/07, Charles Oliver Nutter <charles.nutter / sun.com> wrote:
> Is there a historical reason why I can't do something like these:
>
> x = String
> class x; end
>
> or
>
> def x; String; end
> class x(); end
>
> or any other combination of an arbitrary syntactic construct that might
> produce a class? Was it done to simplify parsing or evaluation of classes?
>
> The reason I ask is for something in JRuby. In JRuby we can refer to
> Java classes using a long-hand syntax:
>
> java.lang.System
>
> which basically calls methods java and lang to get "Package" objects,
> and a System method to get a proxy class for the Java type. But with
> this, we can't do:
>
> class java.lang.System; end
>
> to re-open the proxy class and add utility methods.

It seems to me that java package naming maps more natuarally to nested
Ruby modules

why not

module Java
end

module Java::Lang
end

class Java::Lang::System
end

?

-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/