[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [PATCH] setmetatable({}) causes error
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 13 Jul 2017 09:47:05 -0300
> I'm not allowing v to be omitted, I'm allowing t to be omitted.
Yes, I meant t, sorry for the typo.
Allowing t to be omitted is confusing because it is in the interest of
the programmer to be explicit about what metatable is being set.
setmetatable(v) is not explicit and seems very confusing to me.
Of course, if you are fine with this, use your patch.
But you don't need to patch the C code. You can it in Lua:
local old_setmetatable=setmetatable
function setmetatable(v,t) return old_setmetatable(v,t) end
The code seems useless but the explict argument t implies that it gets
an explict nil if you call setmetatable(v).