> So next question: why, when I define module M inside an anonymous module,
> does Ruby make module M both include and extend the enclosing module?load("file", true) is a security mechanism but, unlike $SAFE = 4, use it
only with file that you can trust because it's easy to bypass it.
Sorry, that's not what I meant. Let me try asking the question differently:
* Why does Ruby do this strange thing of an implicit 'include <Anon>' and
'extend <Anon>' in the first place?
Perhaps it would be clearest if you gave an example of why it is needed? I
have given you an example of where it breaks things
(Aside: this thread was triggered by a question on the mod_ruby mailing
list, where a user asked why strange cyclic include errors happened when he
ran a script under mod_ruby, but it worked fine on its own. I was able to
show him that this was an artefact of load(file,true) - and therefore that
the problem could be reproduced outside of mod_ruby. I'm happy that mod_ruby
needs to run each script inside an anonymous namespace, so that applications
are less likely to tread on each other's top-level namespaces, but I'm now
trying to understand why load(file,true) has to do the things it does which
in turn causes it to break otherwise well-formed scripts)
Thanks,
Brian.