lua-users home
lua-l archive

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


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[1].  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[1] (same function).  This makes them extremely powerful!
You may manage the method tables the same way you handle your data
objects.

Ciao, ET.

[1] 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...