lua-users home
lua-l archive

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


>>Date: Fri, 16 Mar 2018 11:44:31 -0400
>>From: Peter Aronoff <telemachus@arpinum.org>
>>pairs and ipairs were never supposed to be syntax, they are one of any >>number of possible implementations of iteration which were intended to be
>>extended by users and library authors.

>>I'm sorry, but just to be clear: are you saying that every module author >>should create their own custom iteration? That seems like a huge stretch, >>even if we all agree that it’s a strength of Lua that you *can* easily
>>write your own custom iterators.

I do not understand your point. We are talking about the utility of the "__ipairs" metamethod. To use that you effectively have to write another function that does what "ipairs" does but differently (if it does it the same, you do not need the metamethod). So it is no more effort to present that function as a method or as a function in the library.

Of course the need for ipairs itself is also debatable (and has frequently here been debated!).