[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaJIT 64 bit integers (was: the purpose of lightuserdata)
- From: David Manura <dm.lua@...>
- Date: Wed, 12 Jan 2011 23:07:02 -0500
On Wed, Jan 12, 2011 at 8:24 PM, Mike Pall <mikelu-1101@mike.de> wrote:
> Cdata objects are a distinct type, but treating these as unequal to
> any number or not comparable would be rather counter-intuitive:
> e.g. 1LL == 1 should really return true [...]
> But it's unclear how far one should take this.
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. The
principles in [1] may therefore apply just as well here.
Ocaml is one example of a language where floats are heap allocated
while integers are not [2], and it doesn't do implicit conversions
between these two numeric types (for better or worse).
[1] http://lua-users.org/lists/lua-l/2010-11/msg00524.html -- "[..]
upwards-compatible 5.2 features in LuaJIT are *DISABLED* by default.
Even though they are unlikely to break anything for most people."
[2] http://pauillac.inria.fr/cdrom_a_graver/www/caml/ocaml/numerical.html