lua-users home
lua-l archive

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

On Sep 17, 2004, at 17:49, Roberto Ierusalimschy wrote:

This is a proposal for a more standard package usage in Lua.  It
includes some changes in the `require' function, some changes in the
`luaL_openlib' function, and a new function `module'. We already got
previous comments about this proposal from Diego Nehab (LuaSocket),
Andre Carregal (Kepler) and Tomas Gorham (Kepler).

Finally got round to reading this post.

I like it.

I have a couple of points of uneasiness (some mentioned by other people in the thread):

1) Distinction between packages and modules seems unnecessary. Allow module A to drag in other modules if necessary.

2) Can we have "./?;" in the default package.path like require currently has?

3) It prefers binary modules over lua modules. I'm exactly sure what to think about this. Obviously it makes tweaking or subverting a binary lua module harder, but I don't use binary lua modules, so I don't have any experience to draw on.

4) A given lua file that implements a module may exist in more than place in the filesystem. A trivial example is a case-insensitive filesystem on Mac OS X. << require "Trace";require"trace";require"TRACE" >> will pull in the same file 3 times. It seems undesirable that I should be able to go << require'trace' >> and the module gets plonked in the global trace, but if I go << require 'Trace' >> is still works, but the same module gets plonked in the global Trace. An obvious solution is to downcase all module names before using them (and perhaps make the downcase function user over-ridable?). I personally would prefer module names of the form 'Trace', 'String', etc, but that's not the current Lua style, and downcasing seems better globally.

It would be nice to have some standard info about modules (such as author, help, license, and so on) but I don't think that now is the right time to discuss that.

David Jones