[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: High-level vs low-level overrides / Multi-level overrides
- From: Nagaev Boris <bnagaev@...>
- Date: Mon, 1 Aug 2016 22:48:03 +0300
On Mon, Aug 1, 2016 at 8:50 PM, Soni L. <firstname.lastname@example.org> wrote:
> Lua 5.2 introduced __ipairs. It's a high-level ipairs() override, as it
> overrides ipairs() itself.
> Lua 5.3 removed __ipairs and instead added the low-level override __index.
> It overrides the primitive (low-level) operations used by ipairs(), instead
> of ipairs() itself.
> Why can't we have both? I.e. try __ipairs first, if that fails use __index,
> We could also get a __next metamethod and a rawnext() function. pairs()
> would then first try __pairs, then try __next.
> Disclaimer: these emails may be made public at any given time, with or
> without reason. If you don't agree with this, DO NOT REPLY.
What is the motivation behind this proposal? I think the whole idea is
not ideal. It adds to complexity of the language.
PS. Given Lua had __pairs, ipairs (and __ipairs) would be unneeded. To
get current ipairs, one would set __pairs to current ipairs and invoke