On Oct 10, 8:48 ¨Âí¬ ÐåôåÐë ¼ðåô®®®Àìéöéîç÷ïòë®ãïí÷òïôåº > Thanks - actually it does answer the question, but it also answers that > I have to wait until Ruby 1.9 for the "fix" > > that is unless there is a workaround way (until 1.9) to > > doInConstanScopeOf [Module] do > # so instead of 'Module::CONST' one can do 'CONST' > end > > so one could do > > def doIt(&block) > doInConstanScopeOf AModule &block > end > > and explicitly define the constant scope to be the scope of "self.class" > > so when will the fabled 1.9 be available :) > > > > > > Florian Gilcher wrote: > > This is a bit of a strange problem. Ruby 1.8 resolves constants > > lexically. > > > So you are actually referring to ::CONST there. > > > In Ruby 1.9, this is different. In Ruby 1.9, Constants are resolved by > > self . > > So, in short: > > > ¨Âìáóó > > ¨Âïäõì> > ¨Âîä > > ¨Âîä > > > ¨Â®îå÷®éîóôáîãåßåöáì äï > > ¨Â > > ¨Âîä > > > crashes in 1.8, but resolves B as A::B in 1.9. Some people hate that > > change > > in behaviour, I like it. > > > It doesn't directly answer your question, but I hope it gives you > > enough insight to find a way to do what you want. > > > Regards, > > Florian > > > On Oct 10, 2009, at 12:14 AM, Peter Pk wrote: > > >> <br> > >> instance of a class that defines the constant or subclass of it or > >> "const_missing" > > >> This so it can be like Java to get "this.CONST" > >> -- > >> Posted viahttp://www.ruby-forum.com/. > > > -- > > Florian Gilcher > > > smtp: f... / andersground.net > > jabber: Sk... / jabber.ccc.de > > gpg: 33148E2 > > -- > Posted viahttp://www.ruby-forum.com/. well in Ruby 1.8 something like this works (obviously not it all cases, but you get the gist and can fix it as needed): Obj.new { puts "CONST = #{self.class.const_get("CONST")}" } And what do you mean by "waiting" until Ruby 1.9? 1.9.1's been released and stable for the better part of this year now.