[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: [ANNOUNCE] LTN 7 - Modules & Packages
- From: "Samson, Lyndon [IT]" <lyndon.samson@...>
- Date: Wed, 6 Jun 2001 09:29:13 +0100
I wonder how easy it would be to introduce namespaces/packages?
From: John Belmonte [mailto:email@example.com]
Sent: Wednesday, June 06, 2001 3:48 AM
To: Multiple recipients of list
Subject: Re: [ANNOUNCE] LTN 7 - Modules & Packages
At one time I had spent much thought on implementing modules in Lua. I
considered the necessity of using upvalues for local module access
intolerable. It's messy to have to think about if you need the '%' or not
every time you use the name 'Public' or 'Private' in the module definition.
However I think Roberto's method is the best we can do for now. Someday if
we could replace upvalues with more general lexical scoping this issue would
I was also trying to solve the problem of clashes between the global module
names themselves, and between module names and user program names.
Extending the method Roberto outlined it would be possible for a module,
instead of declaring a global, to pass its local public table as a return
value of the chunk. The module user is then free to assign that variable to
some other name, local or global. If the module user choses a local name,
he will have to access the module using upvalue syntax (when inside function