[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua 5.3: wrong coercion?
- From: "Alexandre (gaumerie)" <gaumerie@...>
- Date: Sat, 17 Jan 2015 09:29:00 +0100
I was not expecting that behaviour neither. However, it is consistent with what Roberto told during the conversation about the power (x^y) operator: the result type of the operator should depends only on the operandes types and not the operandes values.
If string where converted to integer or float according their values in the addition operation, you would have:
String + Integer -> Integer (if the string represents an integer) or Float (if the string represents a float)
The current behaviour give:
String + Integer -> Float
String + Float -> Float
in all cases (given that the string represents a valid number) and so there is no surprise about the result type.
--- Original Message ---
From: "Dirk Laurie" <email@example.com>
Sent: 17 January 2015 07:20
To: "Lua mailing list" <firstname.lastname@example.org>
Subject: Re: Lua 5.3: wrong coercion?
2015-01-17 0:29 GMT+02:00 Lorenzo Donati <email@example.com>:
> the whole string->number automatic coercion thing seems to have become a bit
It's the same as it always was, but we've started talking
about it a lot more. At the C code level it just does the
minimum, as Roberto explained.