[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Arithmetic on strings
- From: liam mail <liam.list@...>
- Date: Wed, 13 Jun 2012 18:14:13 +0100
On 13 June 2012 17:35, Roberto Ierusalimschy <firstname.lastname@example.org> wrote:
> Any performance-conscious code that uses
> coercion in critical pathes deserves what it gets
It could be said anyone that updates to 5.2.* deservers what they get.
So I take it that if coercion is removed then string concatenation
would use the '+' operator and Lua programmes would become more
complicated or are these views now outdated?
One of the few (and rather minor) innovations in Lua was
the syntax for string concatenation. The natural ‘+’ operator
would be ambiguous, because we wanted automatic coercion of strings to
numbers in arithmetic operations.
This coercion is useful because it simplifies programs and avoids the
need for explicit conversion functions.