[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: index tag method
- From: "John Belmonte" <jvb@...>
- Date: Wed, 14 Feb 2001 14:23:24 +0900
Steve Dekorte wrote:
> I think the most common use of a hook on table access is to implement
> inheritance. In that case, you only care about look ups on missing table
> elements. Having to handle all look ups just to catch the nils would be
> very slow, particularly if your hook is implemented in Lua.
I see your point about that being a common use. Tag methods represent very
low level events (after all they are called from the VM), so my view is if
one even thinks the word "performance" you have to implement frequently used
hooks in C, not Lua. So it's a question of how fast the VM can call a
C-side function.
Edgar Toernig wrote:
> IMHO these two methods are too useful for general Lua/Sol programming
> (fallback methods/inheritance, default elements, caches, ...). In
> contrast set/getglobal is mostly used for debugging and set/gettable
> for table simulation - nothing that I would use for a typical program-
> ming task.
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? 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. But I think some work needs to be done
reducing the hook call overhead. Removing the index tag method was one
idea... but it's not enough, not popular, and can't be done with backwards
compatibility. Looking elsewhere...
Thanks,
-John