lua-users home
lua-l archive

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

Reuben Thomas wrote:
> 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.

I think that exactly this is what is required: A discipline on how to
write modules.  You cannot perform self-discipline if you don't know
what the discipline is ;-)  IMHO there has to be a definition of a
standard execution environment.  What can modules expect to exist, how
they are supposed to export their functionality, how are modules loaded
and used.  In languages like Modula this is build right into the language.
In Lua no such policies exist.  Everybody invents his own concept.  And
this has two major drawbacks: first, you "have to invent" which may be more
difficult than you want and then you may get problems of module interaction
because of different ideologies (conflicting use of shared resources, in-
compatible calling conventions, dependency handling, ...).

If Lua is simply used as a scripting extension of a larger project all
this is normally not required.  The project defines the environment.
But if you want to use it as a standalone extendable language some
policies are required.  And then part of the design is the question:
"we enforce this policy" or "it only works with self-discipline".
(I would always choose the later ;-)

Ciao, ET.