[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [PATCH] setmetatable({}) causes error
- From: Nathaniel Musgrove <proton.zero@...>
- Date: Thu, 13 Jul 2017 05:54:27 -0700
On Thu, Jul 13, 2017 at 5:47 AM, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
> 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.
There are exactly zero other scenarios in Lua where f(nil) produces different
behavior than f(). The fact that this function is the sole exception to the
rule violates the principle of least astonishment.
If the programmer wishes to use an explicit nil, that should be their choice,
not an arbitrary requirement that exists nowhere else.
Regards,
Nathaniel