[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: index tag method
- From: "John Belmonte" <jvb@...>
- Date: Fri, 16 Feb 2001 13:05:55 +0900
Edgar Toernig wrote:
> > I think set/gettable are important for general use. You mentioned
> > to work on namespaces/modules... do you plan to implement them by adding
> > Lua's syntax and semantics?
> Syntax: No. I think that the elements present in Sol are sufficient.
> Semantics: Yes. IMHO some changes (methods) would make it better.
I can't argue with that, but I'm trying to work out a practical solution for
Lua. Until Lua becomes Sol or Sol becomes Lua, Sol being sufficient doesn't
help this particular task.
> Concept: Modules exports one table (or more). This table holds exported
> functions and data objects (File.open, File.stdout, Socket.connect).
Already with that start I think a problem exists. To code readable modules
(that is, without making a rats nest of upvalues) the module's table needs
to be a global. To make a global you have to pick a name, and therefore
will have name clash problems. To be fair Python has the same problem (what
if two modules have the same file name?). However I'm thinking of a more
general system that can be used for namespaces also, in which case the
chance of name clash is much higher.
The way I'm thinking to get around this is with get/settable hooks, assuming
a Lua change where global accesses trigger those hooks. First I'm working
on that Lua change which I believe is helpful in any case. When that's done
I may take a stab at a module/namespace solution.
Anyway I think there are several ways to deal with these issues and it's
good that a few approaches are being explored.