On Sat, Aug 11, 2018 at 11:29:41AM +0200, Pablo Rodriguez wrote:
I realize that the fault is mine, but with backwards compatibility I meant that the same operation (10 + "10") gives different results with different Lua versions.
It doesn’t, it returns 10 in both cases. The difference is in the behaviour of the print function. Try print(10.0) in Lua 5.2 and 5.3: the former prints 10, the latter 10.0. That is consistent with the part of the specification you quote in another email: in Lua >= 5.3, a number with a decimal point in it is always interpreted as a float. If the number to be printed is the result of some computation, however (instead of lexical analysis), a choice needs to be made: that is where the change occurred, since in Lua 5.2 print displayed the shortest possible representation, while in Lua 5.3 it chose to interpret the number as a float. It’s a reasonable choice and breaking compatibility for an elementary function such a print is to be expected when such a change in the language occurred; even desirable, in my opinion. Best, Arthur