lua-users home
lua-l archive

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


> - The luai_num* macros lost their first argument 'L'.
> [...]
> I can see the rationale for not allowing them to throw errors
> due to the introduction of constant-expression evaluation
> at compile time.

There is another problem. Some functions that use those macros
do not even have the state as argument. (luaH_getnum, luaH_get,
arrayindex, luaO_rawequalObj, plus constfolding). Because those
macros did not use L, the error went undetected in 5.1 alpha.

Of course we can add the L only on some macros (i.e., do not put
it on luai_numeq), but we still have the problem with constfolding...


> Adding definitions for the 3 1/2 interesting cases to luaconf.h
> shouldn't be too much overhead. This would be double, float,
> int/long (long only for 16 bit systems).

This seems the perfect job to be done outside the distribution,
by somebody else (so people do not complain with us if it has
some bug :) We can even add some comment about that in luaconf
(something like "see the Lua wiki for instructions on how to
compile Lua for other numeric types").


> - OP_TEST is marked in lopcodes.c as an instruction setting
>   register A. This is clearly not true since the introduction
>   of OP_TESTSET. I wonder why this was changed from 5.1-alpha
>   to 5.1-beta?

This is a hack. We need that to avoid wrong error messages. The
point is that a OP_TESTSET R1 R1 is translated to a OP_TEST,
but that operation indicates that some code we may be skiping
may also change R1, so we cannot trust its origin. (I don't
remember the exact case, but was something like in (a or b)+0 the
error message was "a is not a number".)


> There are still some upper-case element/attribute names left.

Can you locate them?

-- Roberto