lua-users home
lua-l archive

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


On Fri, 17 Sep 2004, Roberto Ierusalimschy wrote:

This is a proposal for a more standard package usage in Lua.

Sorely needed, and good to see it's being done. I like the way that pre-compiled and Lua modules are treated uniformly. This is important.

* A *package* is a collection of modules distributed together.
Each *module* lives in single file, which contains a single module.
(Of course, a package may comprise a single module.)

I'm skeptical of these definitions. I like the namespace rules, but I'm not sure why packages need to exist (are package-relative module names really useful?), nor what "distributed together" means. In particular, packages seem to be ocnfused with namespaces: why shouldn't independently-distributed modules providing related functionality be grouped into a package (and even require one another)?

The "one file = one module" rule is arbitrary and wrong. Most languages with a decent module system don't have it. Modules are effectively types (= namespaces), not physical units of code. Of course, there's nothing wrong with demanding that each module be loaded by a single file.

I think, all in all, this proposal suffers from feature bloat. Yes, the current various namespace/module schemes need to be accommodated, and yes, a credible standard is needed so we can stop worrying about how to integrate code from different sources. But this won't be done by being too complex.

The CPAN model might offer some lessons here: from a code writing (as opposed to packaging) point of view, it's almost trivial to write a new CPAN module, and yet it provides an effective way for programmers to contribute to the massive pool of Perl it provides.

--
http://rrt.sc3d.org/ | Crews help mock terror casualties (BBC)