lua-users home
lua-l archive

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


Andrea:

On Thu, May 21, 2020 at 12:34 AM Andrea <andrea.l.vitali@gmail.com> wrote:
> I take also the opportunity to suggest again that we could also get rid of get/setmetatable as the Team has done in the past with get/setfenv:
> _META[t] = mt -- instead of setmetatable(t,mt)
> mt = _META[t] -- instead of mt = getmetatable(t)
> I trust the Team will make the best choice as they have always done.

Me trust too.

Anyway, I'd like to point I find this the classic abuse of operator
redefinition which leads to some obscure syntax. You have to remember
_META is a especial global ( or do you prefer to make it a magic
keyword ? ), you have to remember _META[1] or pairs(_META) are going
to work differently than an normal table ( i.e., what would
pairs(_META) do after a _META[t1]=m1, _META[t2]=m2.

Along the years I've found functions work best for this thighs for me,
it is much clearer you are doing something special, much easier to
parse when reading code.

FOS