From: matz@... (Yukihiro Matsumoto) Date: 2003-02-20T01:54:55+09:00 Subject: Re: module This::Encompassing::That Hi, In message "Re: module This::Encompassing::That" on 03/02/20, nathaniel@NOSPAMtalbott.ws writes: |Do you mean that | | module A | end | | class A::B | end | |and | | class C | end | | module C::D | end | |would both be errors? No, the former would not be an error, since class A::B end is equivalent to module A class B end end The latter would be an error, because module C::D end is equivalent to module C module D end end that causes class/module contradiction. |Why? It seems that if I already created the |container(s) (which I think should be required), I should be able to put |either a module or a class inside of them, regardless of whether they're |a module, a class, or both. Because classes and modules are not always exchangeable. Making them too "smart" delays error detection. For example, two files use name A for different purpose, one for module, one for class: a.rb: class A end b.rb: module A::B end then if you load "b.rb" first, you will get error. What if you load "a.rb" first? I think it should report error. Otherwise you can't tell whether A is a class or a module from the source without global analysis, or worse, it might vary time to time. matz.