lua-users home
lua-l archive

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


On 7 April 2015 at 22:25, Javier Guerra Giraldez <javier@guerrag.com> wrote:
>> That's very interesting ... so essentially it is allowing user to
>> define metatable only once - no changes allowed, so then it is free to
>> optimise the way the metatable is used?
>
>
> i guess that's the motivation for the restriction: since it knows the
> methods won't change, it's free to do the table fetch only once and
> compile a straight function call (which could even be flattened away
> by the trace compiler)
>

Of course, in the FFI worldview the metamethods would be written in
Lua, so they could be completely inlined by LuaJIT.
Thanks for the insight - gives me food for thought. Although I use
LuaJIT I don't use FFI, so am not familiar with the ins/outs of FFI.

Regards
Dibyendu