Re: lua-l Digest, Vol 92, Issue 54

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: lua-l Digest, Vol 92, Issue 54

John Hind
> >>Date: Fri, 16 Mar 2018 11:44:31 -0400
> >>From: Peter Aronoff <[hidden email]>
>> >>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!).