[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Next Version of Lua?
- From: steve donovan <steve.j.donovan@...>
- Date: Wed, 10 Jun 2009 13:19:28 +0200
On Wed, Jun 10, 2009 at 12:57 PM, John Hind<email@example.com> wrote:
> If this were a democracy (which it isn't probably explaining why we do not
> have a 'Swiss Army Chainsaw'), I'd vote for a '__iter' metamethod so you
> could provide a customised iterator factory for an object class. This would
> allow syntax:
> for k,v in obj do ... end
> rather than the present (and in my no doubt controversial view, ugly and
I've missed that since 5.0, but I understand the rationale, in the
_absence_ of __iter!
I've found myself wishing I could iterate over my list objects with
'for v in l do..end', which would be a piece of cake with __iter.
PS. An excellent comment on our gentle dictatorship. Gave me a laugh: