lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


This is good, but trouble is you get lots of global iterator factories with
ill-defined behaviour if applied to the wrong class. The method approach
solves this, so:

for v in set:values() do ... end

But the need for that empty parenthesis still rankles ...

> -----Original Message-----
> From: lua-bounces@bazar2.conectiva.com.br [mailto:lua-
> bounces@bazar2.conectiva.com.br] On Behalf Of Miles Bader
> Sent: 14 September 2009 09:00
> To: TNHarris
> Cc: Lua list
> Subject: Re: Regarding the name 'pairs'
> 
> TNHarris <telliamed@whoopdedo.org> writes:
> > It's "each" instead of "iterate" simply for being shorter. I don't
> > particularly care for "iter" and "enum" because they're
> abbreviations.
> > And "enum" already has a meaning in C.
> 
> Hmm, I'd use "values(set)" rather than "each":
> 
>    for v in values(set) do ... end
> 
> -miles
> 
> --
> Fast, small, soon; pick any 2.