lua-users home
lua-l archive

Re: ipairs in Lua 5.3.0-alpha

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2014年08月17日 23:53 GMT+02:00 Jan Behrens <jbe-lua-l@public-software-group.org>:
> Still looking forward to feedback.
I don't like it. I don't like Lua 5.3.0-alpha ipairs either.
What you, and Lua 5.3.0-alpha, have been trying to do
is to second-guess what semantics ipairs should have
if a programmer has been tinkering with __len and __index.
And Lua 5.3.0-alpha is so prescriptive about it that the
programmer does not even have the freedom to override
that guess.
I think _any_ iterator that is metatable-aware must either
be very explicitly specified (e.g. by __pairs or __ipairs)
or stashed in the table library, which can have its own tight
well-specified protocol.

AltStyle によって変換されたページ (->オリジナル) /