From: matz@... (Yukihiro Matsumoto) Date: 2000-03-23T13:17:54+09:00 Subject: [ruby-talk:02099] Re: Scope violated by import via 'require'? Hi, In message "[ruby-talk:02084] Scope violated by import via 'require'?" on 00/03/22, Clemens Hintze writes: |But if I put the definition of the inner module 'Bar' in a file on its |own called e.g. 'mBar.rb' and 'require' this file during module |definition of 'Foo', 'Bar' will be known both within 'Foo' and outside |of it: Well, it's an expected behavior (at least I as expect it ;-) require()/load() evaluates the contents of the file at the toplevel. So by this example: | $ cat mBar.rb | module Bar | end | | $ ruby | module Foo | require "mBar" | end 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. matz.