[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (work3) now available
- From: Duncan Cross <duncan.cross@...>
- Date: Tue, 18 May 2010 22:51:14 +0100
On Tue, May 18, 2010 at 10:35 PM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> On Tue, May 18, 2010 at 8:12 PM, Petite Abeille
>> <petite.abeille@gmail.com> wrote:
>> > Hmmm... ipairs? deprecated? ouch.
>>
>> Wow, yeah. Pretty bold. I notice that the readme still refers to it:
>> "ipairs now goes until #t" (i.e. respecting __len metamethods) - and
>> that change (as far as I understand it) must have meant either
>> changing what ipairs returns into a closure, or else calculating #t
>> every iteration - both of which would have been a bit costlier than
>> what the old one did.
>
> Not really. It only needs to calculate #t when the value is nil.
>
Well, my thought was that it's possible you might have (something
like) a table used as a stack that just alters its "length" field
(that the __len metamethod refers to) when elements are popped,
leaving garbage values past the end. But it's probably not very likely
people would do that in practice.
-Duncan