lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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.

Throwing it into the global namespace then causes it to potentially clash
with any old global that the user's program may have.

> No muss, no fuss.

Lot's of muss... lot's of fuss.

*cheers*
Peter Hill.