[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [PATCH] setmetatable({}) causes error
- From: tobias@...
- Date: Thu, 13 Jul 2017 22:51:56 +0200
Quoting Nathaniel Musgrove <proton.zero@gmail.com>:
By comparison, setmetatable(t) actually performs a task, one that a
programmer
would be entirely reasonable in wanting to perform.
It is very much dependent what is the expected outcome seen from the
programmers perspective. For example:
if a==b then ... end
vs
if a=b then ... end
are both entirely viable pieces of code but one could be an error if
the it was basically a typo. setmetatable(t) falls into the same
category for me. The error allows me to catch a potential problem much
sooner. I wouldn't even do what Luiz' suggested and overwrite the
function with the same name. Create a function called removemetatable(t)
is much more clear. We do have mandatory code reviews at work and
that made me appreciate clarity in code very much but then again,
it's just an opinion :-P
-tobbik