[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Iterators vs Lambdas
- From: steve donovan <steve.j.donovan@...>
- Date: Tue, 10 Sep 2013 18:43:11 +0200
On Tue, Sep 10, 2013 at 6:27 PM, David Demelier
<demelier.david@gmail.com> wrote:
> The second one maybe more performant (I guess, not tested) on huge
> objects. Also the second one may use different function as parameter
> without rewriting the for loop in the first one.
It's a matter of taste, I think. Lua itself went from the 2nd form
('internal iterators') like table.foreach to the 1st form ('external
iterators'). A little less clunky, and coroutines make the 1st form
possible for even quite awkward operations like traversing a binary
tree.
Pick one and use it consistently, that seems to be the main thing ;)