[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: modules, require, magic
- From: Josh Simmons <simmons.44@...>
- Date: Tue, 18 Oct 2011 18:33:45 +1100
On Tue, Oct 18, 2011 at 6:28 PM, Josh Simmons <email@example.com> wrote:
> On Tue, Oct 18, 2011 at 6:20 PM, Sean Conner <firstname.lastname@example.org> wrote:
>> "But module() and require() could keep a private table with references to
>> each module and not dump them into the global space," you say. Okay, but
>> you *still* need a global namespace, because DarkGod has *his* DNS module
>> (named dns) and I have *my* DNS module (which would also be named "dns"), so
>> which one is returned when you require("dns")? (assuming that I have
>> modules I wrote using my DNS module, and some other modules I want to use
>> might be using DarkGod's DNS module)
> Require already does this, and you need to separate them at the
> filesystem level irregardless of what scope they're imported into.
> local dns = require 'crazy.weird.dns'
> local dns2 = require 'somebody.elses.dns'
> None of this has anything to do with global scope or module.
Interestingly enough this is actually worse if you use module and they
both name themselves 'dns' in which case the value of the global just
depends on who got in last.
- 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
- Re: modules, require, magic, Josh Simmons