[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaJIT 64 bit integers (was: the purpose of lightuserdata)
- From: Tony Finch <dot@...>
- Date: Thu, 13 Jan 2011 14:51:57 +0000
On Wed, 12 Jan 2011, David Manura wrote:
> Even `1LL == 1` may not be so clear. In code like `if b == 1 then
> [...] end` written only with standard Lua in mind, it can be assumed b
> is 1 inside the block, or at least that b has all the properties that
> 1 has. It's conceivable (however remotely) that this code may break
> under the above proposal if 1LL somehow makes it into b.
It is in fact quite likely if b is used to index a table, if I understand
Mike's description correctly.
If FFI objects are necessarily boxed, it seems to me reasonable to require
some kind of explicit conversion from a cdata ((long) long) int to a Lua
number, such as `if b.n == 1 then ...`.
f.anthony.n.finch <firstname.lastname@example.org> http://dotat.at/
HUMBER THAMES DOVER WIGHT PORTLAND: NORTH BACKING WEST OR NORTHWEST, 5 TO 7,
DECREASING 4 OR 5, OCCASIONALLY 6 LATER IN HUMBER AND THAMES. MODERATE OR
ROUGH. RAIN THEN FAIR. GOOD.