lua-users home
lua-l archive

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


A few weeks ago, I mentioned on this list that I was working on an
enhanced module system for Lua that would provide strong isolation
between modules, namespace control, and other attributes.  And it
provides a declarative syntax for dependencies between modules.

A key design goal was to be compatible with Lua's current module
system, so Darwin should be easy to try out.  You should be able to
load it and not even notice it until you want to use it.  When you
want to take a module you already have, e.g. {{modname}}, and define a
Darwin structure for it, you can create a structure definition and
load it.  Then, when other code does {{require "modname"}}, Darwin
will open the structure for you, i.e. load the module.

The source (including a basic test suite to verify that Darwin is
working) and documentation are attached to this page:

http://lua-users.org/wiki/JimJennings

To use Darwin, download darwin.tgz and extract it in a directory that
'require' will find.  Then:

require "darwin"

To test the system:

require "darwin.test.regression"

If everything is working, the output will end with " ** ALL TESTS
PASSED ** ".  There are examples in the documentation, and more in
darwin/test/regression.lua (although those examples are not as
useful).

Those that are interested in exploring ideas for module system
enhancements should take a look or even try it out.  I welcome
feedback, and I do intend to fix bugs and make enhancements.

Jim