[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: import and LuaBinaryModules
- From: Thatcher Ulrich <tu@...>
- Date: Thu, 6 Mar 2003 10:02:47 -0800
On Mar 04, 2003 at 10:29 -0500, Doug Currie wrote:
> Tuesday, March 4, 2003, 8:31:14 PM, Thatcher Ulrich wrote:
>
> > In a nutshell, the objection I have to these gymnastics is that they
> > don't solve the underlying problem, which is in order to avoid name
> > clashes, modules need globally unique names. When you say:
> > import "a"
> > The "a" needs to uniquely specify the desired module. If someone else
> > in the world implements a different module named "a", you still have a
> > name clash, regardless of whether you can put the results of import()
> > in an arbitrary table.
>
> I disagree, at least at the language level.
>
> In your example, "a" is just a (part of a) file name. It gets turned
> in to "luaa.dll" by LuaBinaryModules, for example. A name clash here
> can be fixed easily by renaming one of the files, perhaps to
> "luaa-old.dll" and "luaa.dll" or putting them into different paths in
> the file system.
Yeah, that's a good point. Nevertheless, if you want to, you can
still do:
import "a.b.c-old"
local c_old = a.b.c
a.b.c = nil
import "a.b.c"
local c = a.b.c
But aliased module names is a pretty bad problem to have; packagers of
modules and distributions need to be careful to avoid it as much as
possible.
--
Thatcher Ulrich
http://tulrich.com