[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Question on get/setmetatable()
- From: Francisco Olarte <folarte@...>
- Date: Thu, 21 May 2020 10:22:14 +0200
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
- References:
- Question on get/setmetatable(), Andrea
- Re: Question on get/setmetatable(), pocomane
- Re: Question on get/setmetatable(), Philippe Verdy
- Re: Question on get/setmetatable(), Andrea
- Re: Question on get/setmetatable(), Gé Weijers
- Re: Question on get/setmetatable(), Andrea
- Re: Question on get/setmetatable(), pocomane
- Re: Question on get/setmetatable(), Andrea
- Re: Question on get/setmetatable(), Lorenzo Donati
- Re: Question on get/setmetatable(), Andrea