[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: modules, require, magic
- From: Mark Hamburg <mark@...>
- Date: Tue, 18 Oct 2011 07:11:29 -0700
On Oct 18, 2011, at 12:20 AM, Sean Conner wrote:
> Assume for a moment there are several other modules that require this
> module. Without a global namespace, each module will get their own copy of
> this module, which would mean wasted space as there are multiple copies of
> this data (and that paths table could be pretty big ... )
require will only load a module once. Subsequent uses of require will just return this same module.
The globals issue has to do with whether a change is made to the globals table. You can still refer to your module as org.conman.dns and require will do the right thing.
The danger with changing the globals table is that code might start referencing org.conman.dns without doing an appropriate require and would just happen to work because some other code that ran before it did the require. And then it later breaks because the code execution sequence changes somewhere and you can't figure out why code that used to work just fine no longer works.
- modules, require, magic, Eduardo Ochs
- Re: modules, require, magic, Javier Guerra Giraldez
- Re: modules, require, magic, Petite Abeille
- Re: modules, require, magic, Sam Roberts
- Re: modules, require, magic, David Manura
- Re: modules, require, magic, Mark Hamburg
- Re: modules, require, magic, Sean Conner