[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: '__iter', yet again!
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 17 Dec 2009 08:27:04 +0200
On Wed, Dec 16, 2009 at 11:57 PM, Geoff Leyland
<geoff_leyland@fastmail.fm> wrote:
> for v in elements(obj) do ... end
>
> really too ugly?
To me, it's consistent with pairs/ipairs, which will apparently
respect the __pairs,__ipairs metamethod.
So maybe call it iter(), and make it understand __iter. Not
complicated, as you say, and quite efficient to do in Lua.
One of the reasons that there's so much pressure for features to go in
the core is the the lack of standard libraries. So I may use iter()
as a global but without community consensus it's a personal
convenience, nothing more. Personally I prefer using a iter() method,
avoiding a global.
steve d.