[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: get_local() and "(for index/limit/stop)"
- From: Rici Lake <lua@...>
- Date: Wed, 15 Sep 2004 19:21:06 -0500
On 15-Sep-04, at 7:28 PM, Fabio Mascarenhas wrote:
Then the right thing is the behavior of Lua 5.0.2 (in fact, this is
the way for is explained in the reference manual :-) ).
That is true, "right" is quite subjective. I had quotes around it at
first, but they seemed redundant.
You can easily have it the other way by explicitely declaring another
Yes. But it is hard to think of a case where you would not want the new
Well, I'm sure this new way will be documented in the 5.1 reference
I have no doubt. This does not mean that it is necessary to define the
behaviour in the case of assigning to an index variable, though -- I
have no problem with explicitly documented undefined behaviour;
assigning to index variables is probably poor style in any event.
And the loop variable is not really created anew each iteration; the
same register is reused. There is no performance penalty.
In fact, it is quite possibly slightly faster for "for ... in"
statements. The loop variable is *conceptually* created anew each