lua-users home
lua-l archive

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

On Tue, Aug 23, 2005 at 02:06:18PM -0700, Brent Arias wrote:
> Ok, yes, I figured that was what was happening.  However, I don't understand
> why.  What inspired Lua, fortunately, to not evaluate the perm{"a", "b",
> "c"} expression over and over again?
it's just the definition of for .. in

look at, say, java:
i = thecollection.iterator();
while (i.hasNext()) { ...
// they have a syntax construct for this, nowadays, don't they?

anyway: you would not call thecollection.iterator() over and over,
but rather the one iterator you got for this job.
you would note make much progress otherwise :)