From: Christian Neukirchen Date: 2005-11-23T04:02:50+09:00 Subject: Re: C extensions and class constants nested within modules Daniel Berger writes: >>>>>>>"D" == Daniel Berger writes: >> D> Why doesn't that work? >> Because this is parse.y and eval.c which make work >> class Bar::Baz >> end >> and not the call to rb_define_class() >> With rb_define_class("Bar::Baz"), ruby has defined a class >> "Bar::Baz" and >> not a class Baz under Bar (what it look with Foo::Bar::Baz) >> D> The only way I could get it to work was to declare "Baz" under >> "Bar". But is D> that really the same thing? >> In your case probably. > > What's the difference between these two? > > module Foo > class Bar > end > class Bar::Baz > end > end > > module Foo > class Bar > class Baz > end > end > end > > Is there any difference? What are the potential pitfalls, if any? You could hit issues with constant lookup, but from a code point of view they should be the same. > Dan -- Christian Neukirchen http://chneukirchen.org