"Brian Schroeder" <> schrieb im Newsbeitrag
news

. ..
> Hello Group,
>
> I think that ruby is a bit too intelligent regarding module names.
No, that's usual scope resolution practice as found in other languages (C++
etc.). Module resolution starts always at the nearest possible position,
which makes perfectly sense since it saves a lot of typing for the usual
case, i.e. when you want to refer to something in a sibling module.
> Consider the follwing situation
>
> module B
> class B; end
> end
>
> module A
> module B
> module C
> class C < B::B; end
As Mr. T already pointed out use the form ::B::B to explicitely start lookup
from the top level.
> end
> end
> end
>
> This does not work, as ruby tries to load A::B::B instead of B::B as
> I supposed. So for example I can't create a class structure
>
> module MyProg
> module UI
> module Gnome
> class Something < Gnome::Canvas
> end
> end
> end
>
> even though this would seem a natural naming scheme to me.
>
> What is the reason behind this behaviour, and is it possible to avoid
> this problem without renaming my module to MyProg::UI::GnomeUI which
> seems redundant to me?
See above.
Regards
robert