lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Wed, Jan 12, 2011 at 8:24 PM, Mike Pall <> 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] -- "[..]
upwards-compatible 5.2 features in LuaJIT are *DISABLED* by default.
Even though they are unlikely to break anything for most people."