[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: ANN: LuaState (A C++ Lua Wrapper and enhanced Lua 4.1 Distribution)
- From: Edgar Toernig <froese@...>
- Date: Fri, 09 Nov 2001 21:11:01 +0100
Joshua Jensen wrote:
> In Sol, tag methods are gone. All former tag methods will call through
> the unified methods table (I believe that's how it worked... If not,
> it's the best approach.).
Right. That's why I called them _unified_ methods ;-) Tag methods
and "user" methods are the same. I.e. the expression x+y (when
x and y are not numbers) becomes x:add(y) and not something like
gettagmethod(tag(x), "add")(x, y).
> The unified method call is actually a touch faster because there are
> no tag method checks.
Not in Sol! Access to the method table follows the usual checks for
tag methods (same function). This makes them extremely powerful!
You may manage the method tables the same way you handle your data
 There's a slight difference between user methods and tag methods:
when the VM needs to fetch a tag method it does not invoke tag methods
for this method table (it's doing a rawget). Else you get nasty loops.
Maybe I'll remove this minor difference in the future...