lua-users home
lua-l archive

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

> I think Python's way could be implemented with Lua's extensions (again with
> improvements).  There is nothing special to do when writing modules.  The
> globals of an imported file become the names within the module.

This certainly sounds like a good way to start (and means that there's at
least a backwards compatible version of modules). However, it can be useful
to say what you want to import from a given module (I suppose you can do
that too without extra syntax), and also to restrict what you export (i.e.
allow private globals).

All this can be done with a certain amount of self-discipline, but then
modules themselves are just a way of controlling the namespace; if all that
was needed was self-discipline we wouldn't be having this discussion in the
first place.

-- | humour, n.  unexpected recognition