[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: New array type? (was: 'table' as fallback for tables)
- From: steve donovan <steve.j.donovan@...>
- Date: Wed, 6 Jul 2016 10:15:45 +0200
On Wed, Jul 6, 2016 at 8:25 AM, steve donovan <steve.j.donovan@gmail.com> wrote:
> in place then the `n` field becomes an implementation detail. The
> table functions start respecting this, and nirvana is achieved.
Alas, but freedom from the wheel of death and rebirth is always harder
than it first seems.
The table returned from table.pack() now has a metatable (for __len)
and inevitably it will be passed to Lua code which doesn't respect
this. For example, pl.List will take a table (_assumed_ to be a
sequence) and slap its own metatable on it, rebranding it as a List
[0]. The carefully-crafted __len is lost in translation.
[0] the name is the result of initial Python-nostalgia, which has faded.