lua-users home
lua-l archive

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


2010/5/20 Peter Cawley <lua@corsix.org>:
> To help understand all of the changes between Lua 5.1(.4) and Lua
> 5.2-work3, I took I diff of the source folders of the two, then
> distilled the resulting 16000 line diff line into an easier to read
> blog post. You may be interested in reading the result (and feedback
> is also welcomed):
>
> http://www.corsix.org/content/look-lua-52-work3

I'm currently reading that very nice and comprehensive article. I have
a few questions though.

Point 16 specifies that if __gc is set in a metatable after it's been
assigned to a userdata won't make it called at collection. If the __gc
is present during setmetatable, but is later changed, will the
original or the new __gc be called at collection ?

Still about the point 16, and the point 23, the latter has the
following code snippet :

    getmetatable(newproxy(true)).__gc = print
    os.exit(0, true) --> userdata

However according to point 16, assigning print to __gc after the
creation of the userdata (inside newproxy) shouldn't be registered. So
is print really called in that situation (and contradicting point 16)
? Will newproxy be updated to be able to give it a __gc ? Or is it
recommended to create a prototype proxy, assign it a __gc, and then
clone it (by passing it to newproxy), the clone sharing the metatable
and hopefully having its __gc acknowledged ?

Also I'm a bit surprised by point 54: luaL_typerror wasn't really a
typo, but rather a contraction. It was consistent with luaL_argerror
(instead of luaL_argumenterror) in having 3 characters between "luaL_"
and "error".