[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: question on ipairs
- From: Andrew Gierth <andrew@...>
- Date: Thu, 21 May 2020 18:25:29 +0100
>>>>> "Coda" == Coda Highland <chighland@gmail.com> writes:
>> why the _ipairs metamethod was deprecated?
Coda> Because there's no need for a metamethod for something as simple
Coda> as ipairs()
Some of us greatly disagree with this position - in particular, it
seriously impacts what you can do with userdatas.
For example, if embedding into an environment (e.g. a database) which
has a native array type (such as SQL arrays) which can be iterated
sequentially more efficiently than they can be indexed into (because
they have variable-length elements), it means that you can't just
provide an __ipairs and have everything just work in the obvious way;
instead, ipairs() will work inefficiently and you have to provide a new
but functionally identical method.
--
Andrew.