lua-users home
lua-l archive

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


On 04/14/2014 10:19 AM, Justin Cormack wrote:
I agree with Roberto, consistent types is more important. If you
cannot tell if something will return float or int you can then no
longer reason about other stuff that depends on it. Anyone trying to
do static analysis on Lua code will have a hard time too.

Justin

As soon as any static analizer hits a function call, it wont be able to decide this anyway.

The power operater can either be:
float ^ float -> float
int ^ int -> int

or

float ^ float -> float
int ^ int -> number

Where number is defined as (float | int).

I am not conviced by either option. The most consistent IMO would be an additional ^^ (int exponent) operator, and apply the same rules for power as for division.

--
Thomas