[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.3.2 (rc1) now available
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 20 Nov 2015 10:12:47 -0200
> On Thu, Nov 19, 2015 at 1:49 PM, Roberto Ierusalimschy
> <roberto@inf.puc-rio.br> wrote:
> >> Lua 5.3.2 (rc1) is now available for testing at
> >> http://www.lua.org/work/
> >
> > What is new:
> >[...]
> > - table.sort "randomize" the pivot
>
> Was there a reason for using ints for the indexes (lo/up)? Why not lua_Integer?
ints are more efficient for 32-bit machines, and are big enough for normal
cases (as arrays in Lua cannot have more than 'int' elements anyway).
> I also noticed that you could easily create a table with a __len
> metamethod to give arbitrary int values for up. I don't immediately
> see a way to break something with that but it may be possible.
I don't see why. Any value it returns represents a regular table full
of nils. There is nothing special here. So, there may be a way to break
something (usually there is), but not because of this particular fact.
(One possible break, not related to the __len metamethod, would be an
arithmetic overflow when computing the pivot <<(lo+up)/2>>; we should
do that computation with unsigneds.)
-- Roberto