From: Robert Klemme Date: 2004-03-31T16:44:23+09:00 Subject: Re: require usage and namespaces "Greg Brondo" schrieb im Newsbeitrag news:GIlac.254$Tw6.33@chiapp18.algx.net... > Ok, I'm a little confused but I know you guys know the answer ;-) > > Say I have script A and it executes a 'require' for module B and module C. > Now lets say that within module B there is also a require for module C that > executes. The wording is not quite correct: you should say "script A requires file B", because require is agnostic of modules. It just knows files. Of course there is this convention to put a module into a file, but a required file need not contain a single module - it can be any non negative number of modules, classes, methods, variables - just a normal script. :-) > Do I now have two copies of module C loaded in two seperate namespaces? Or > is there no harm in this and pretty much the norm? Require ensures that each file is loaded only once. And it is loaded into the top namespace, i.e. it makes no difference whether you do require 'B' module A end or module A require 'B' end although I recommend the first version to avoid confusion. :-) Regards robert