lua-users home
lua-l archive

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


Hi,

John Belmonte wrote:
> 
> I think set/gettable are important for general use.  You mentioned wanting
> to work on namespaces/modules... do you plan to implement them by adding to
> 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 see it being done without change to Lua (except for removing set/getglobal
> which is backwards compatible), as set/gettable tag methods coded in C.

I don't think that modules have to be implemented in C.  This can be done
in Lua/Sol.  You fear the overhead.  And that's the point: I think that
the method concept of Sol would make it more efficient and cleaner than
any implementation with the current Lua API.

Concept: Modules exports one table (or more).  This table holds exported
functions and data objects (File.open, File.stdout, Socket.connect).  Objects
created by the module get attached method tables so that each objects may
be used to call further module functions (fp:write, sock:send, or fp:close
and sock:close).  The difference between Lua and Sol is that in Sol you
get all this as a basic (and efficient) concept of the language whereas in
Lua you have to do some (IHMO) ugly hacks to do that.  (For an implementation
example lock at the luasocket library for Lua and siolib.c for Sol.)

> But I think some work needs to be done reducing the hook call overhead.
> Removing the index tag method was one idea...

It's the actual call and execution of the tag method that generates an
overhead.  Not the check whether that method exists.  And index/newindex
- contrary to gettable/settable - help to avoid calls.

Ciao, ET.