[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: __pairs isn't what we need
- From: Alexander Gladysh <agladysh@...>
- Date: Sat, 9 Jan 2010 20:37:57 +0300
<...>
> ipairs has a similar issue at face value (with it's hidden "inext"
> iterator); but I propose we make it respect __len.
> alternativly, I argue for the removal of ipairs alltogether: it's
> functionality can be replicaed with a number for - and you can always make
> your own ipairs function:
<...>
Actually this makes sense. Now that ipairs hole-handling behaviour
does match the table length operator, there are no reasons left in
keeping ipairs in the API.
Whole array- vs. hash-part situation in Lua is confusing for newbies.
I think, it would probably be a bit clearer if we leave only two
*distinct* ways to iterate the table. I've seen too often bugs where
ipairs is used inplace of pairs and vice-versa.
Alexander.