[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua hacking wondering
- From: Jamie Webb <j@...>
- Date: Thu, 24 Jun 2004 04:02:16 +0100
On Wednesday 23 June 2004 16:47, Roberto Ierusalimschy wrote:
> > Wouldn't it be possible to store a pointer the the internal table
> > structure of the metatable that is ssigned to each table/udata? That
> > way the cost of checking wether a metamethod exists would be one
> > pointer lookup and some bit testing wich is negligible (plus maybe
> > some overhead in lua_setmetatable)
> This is already done. I don't think metatable access is a performance
> problem in real applications.
> > and we would be able to have our precious __settable ,__gettable and
> > maybe __next metamethods.
> The point is not performance. Whenever you set a __gettable metamethod
> to a table, you cannot access that table except through a "rawget" call.
> In other words, you already need some special way to access the table.
Why is this a problem? For the patterns which would use this facility, that's
exactly what is wanted. The 'write detection' pattern would call rawset from
-- Jamie Webb