lua-users home
lua-l archive

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

On Jun 08, 2004 at 01:11 -0400, Diego Nehab wrote:
> I am afraid we will exaust this "global namespace of library names"
> pretty soon.

Not likely; the space of short ASCII strings is gigantic.  E.g. most
of the sites on the web are under .com, .net or .org, and new names
get registered every day.  Other examples of usable big flat

* unix executable names

* C library

* phone directory

> Other languages (and some Lua distributions) have a hierarchy
> scheme, right? This would be another long discussion... My hint here
> is that the require function might have to become aware of *some*
> kind of hierarchical naming convention.

Hierarchies are nice, and luacheia started out with a hierarchical
convention, but one important drawback we ran into is that many
existing C libraries are not trivial to convert to a hierarchy, since
they use luaL_openlib to register their functions.  A substitute
helper function can be provided, but unfortunately that changes the
Lua API, or requires extra helper code be linked into each module.

The same problem applies to conventions where the library returns an
anonymous table.

So we found it easiest to go with a flat global namespace of modules,
and it seems to work pretty well.  Here's the current list of names:

That's hardly the last word on the subject, but I thought I'd throw in
my 2 cents based on our experience with this issue...

Thatcher Ulrich