On Tuesday, February 18, 2003, 3:13:53 AM, Yukihiro wrote:

> Hi,

> In message "Re: module This::Encompassing::That"
>     on 03/02/16, Gavin Sinclair <gsinclair / soyabean.com.au> writes:

> |I don't see a problem with autovivification, though.  If the first
> |line in a program is
> |
> |  module A::B::C
> |
> |what conceptually prevents this from being equivalent to
> |
> |  module A
> |    module B
> |      module C
> |
> |?
> |
> |Naturally, if A::B is a (non-Module) constant, then an error would
> |result.

> What if A or B were classes?

If it makes sense for classes, then well and good.  If not, then
error.  I would avoid making it too smart (as later messages discuss),
because then you'd be forever explaining it to everybody.

I like the idea of autovivification within certain rules.

class A
end

module A::B
end                      # error

The rule is that the Xi in
  module X1::X2::...::Xn
must all be either:
 - modules (not classes); or
 - non-existent (so an empty module can be created)


Gavin