lua-users home
lua-l archive

Re: [PATCH] setmetatable({}) causes error

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


> 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).

AltStyle によって変換されたページ (->オリジナル) /