From: Clemens Hintze Date: 2000-03-24T11:52:32+01:00 Subject: [ruby-talk:02127] Re: Scope violated by import via 'require'? Yukihiro Matsumoto writes: > Hi, Hi, > > In message "[ruby-talk:02101] Re: Scope violated by import via 'require'?" > on 00/03/23, Clemens Hintze writes: ... > | May I ask another > |question? How can I achieve the goal described above? Is there any > |way? > > Well, typical one is like following. > > str = f.read > Foo.module_eval str I have already thought of this. Only I was not sure, if it is the best way or not. But now as you have proposed it, I am convinced it is ok! :-))) > |> module Bar is defined at the toplevel. And in 1.5.x, `::' notation > |> accesses the constants defined in superclasses too, which makes > |> Foo::Bar valid. > | > |That means, it is not in the module Foo, but will be found above in > |Object, yes? Tricky, tricky! ;-) > > Yes. Tell me if you have alternative ideas. Nonono! I have no better idea. It is perfect! I was only stumbled again over the fact, that toplevel means context of class Object in Ruby. This is not a disadvantage. I am only too stupid to remember, I guess. Strange... every time somebody ask me, I can tell him that fact properly. But *I* sometimes get catched by this ;-))) Ruby *is* different from other languages, indeed. :-) > matz. \cle -- Clemens Hintze mailto: c.hintze@gmx.net