"Hadmut Danisch" <spamblock / danisch.de> schrieb im Newsbeitrag
news:b86glk$2fl$05$1 / news.t-online.com...
> Robert Klemme wrote:
>
>
> > You can't. It's locigally impossible since XYZ is part of Monday.
>
> I don't think so. As far as I understand Ruby,
> XYZ is not "part" of Monday. It's still a separate module,
> it's just that the Constant XYZ in Monday's namespace points
> to it.

And that's exactly the reason why you need to know about Monday (directly
or indirectly) to get at XYZ.

> > Everybody who wants to use XYZ must know about Monday.
>
> No. You just need to get the module object from anywhere
> and extend.

"anywhere" is exactly the problem.  If you do this while having a module
XYZ and Monday::XYZ then you will get two results:

ObjectSpace.each_object( Module ){|m| puts m if /(^|::)XYZ$/=~m.name}

You can indentify the corrent XYZ only if you know that it's nested in
Monday.

    robert