[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Check for ipairs() compat mode
- From: Dirk Laurie <dirk.laurie@...>
- Date: Thu, 19 Jul 2018 18:32:20 +0200
2018-07-19 16:28 GMT+02:00 Andrew Gierth <andrew@tao11.riddles.org.uk>:
>>>>>> "Dirk" == Dirk Laurie <dirk.laurie@gmail.com> writes:
>
> >> The newer implementation of ipairs() does not honour if __ipairs
> >> returns more than 2 values.
>
> Dirk> There is no such thing as "the newer implementation of ipairs()".
>
> Yeah, there is.
>
> 5.2 (and 5.3 with COMPAT_IPAIRS) have the implementation "if an __ipairs
> metamethod exists, call that and return its 3 results, otherwise return
> ipairsaux,t,0"
>
> 5.4 (and 5.3 without COMPAT_IPAIRS) has the implementation
> "return ipairsaux,t,0"
>
> I continue to maintain that deprecating __ipairs is the wrong move and
> that it should be reinstated. Just having ipairsaux() respect
> metamethods is NOT sufficient for all cases that __ipairs is useful for.
>
> Dirk> The 5.4 manual says exactly what the 5.3 manual said, that ipairs
> Dirk> "Returns three values (an iterator function, the table t, and 0)",
>
> Dirk> and in fact the __ipairs metamethod still works as in 5.3, with
> Dirk> 'ipairs' adjusting the number of return values from __ipairs to
> Dirk> exactly three, without checking them in any way.
>
> This is NOT THE CASE. In 5.4, __ipairs will never be called; there is
> literally no such metamethod.
>
> You also completely missed the original point, which is not that
> __ipairs itself could return more than 3 values, but that the iterator
> function that it returns could do so.
This post would have been unnecessary if you had read my earlier
update, posted for hours before this message,
I confessed to heving been misled by a binary calling itself Lua 5.4.0
while in fact being a build from a months earlier clone of the GitHub
repository.
I think I'll give myself another three days' holiday from the Lua list.
You are not the only person among recent posters with an abrasive
style verging on personal insults.