George Moschovitis wrote:
> Hello everyone,
> 
> I would like to now if the following snippets of code are equivalent:
> 
> --->
> 
> module My; module Little; module Namespace;
> 
> class Foo
> end;
> 
> end; end; end
> 
> <---
> 
> module My::Little::Namespace;
> 
> class Foo
> end;
> 
> end; 
> 
> --->
> 
> 
> are those snippets exactly the same? Ie i can do:
> 
> foo = My::Little::Namespace::Foo.new?

First of all, you can only do this when the modules already
exist. (How should the interpreter know whether Little is
a class or module?)

Second of all, I think you need parens because of a
precedence issue:

   foo = (My::Little::Namespace::Foo).new?

Refer to a question I asked last week, something like "Nested
classes and the Singleton pattern", and see Nobu's reply.



Hal