[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Re[2]: import and LuaBinaryModules
- From: Thatcher Ulrich <tu@...>
- Date: Thu, 6 Mar 2003 10:09:40 -0800
On Mar 06, 2003 at 12:14 +0800, Peter Hill wrote:
> Thatcher Ulrich:
> > 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. In my opinion, it is much simpler to just
> > adopt the convention that:
> >
> > import "a.b.c"
> >
> > puts its public interface in the global table a.b.c, and then try to
> > impose some organization on module names. If the user wants to alias
> > it, they do:
> >
> > local_alias = a.b.c
>
> Ah, but as far as:
> import "a.b.c"
> goes the name clashs problem only occurs with *other modules*, which
> can be handled by whatever module naming and/or versioning
> convention may be decided upon.
Yes -- exactly! The problem must be solved by packagers and module
maintainers. Once the problem is solved there, it is solved for
everybody; there is no problem in Lua's global table, if the module
names are unambiguous. This is a big piece of the value that a
distribution like luacheia should provide.
Java and Perl, successful languages with enormous class/module
libraries, handle it this way. I don't see the point of trying to
innovate here.
--
Thatcher Ulrich
http://tulrich.com