Re: Arithmetic on strings
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Arithmetic on strings
- From: liam mail <liam.list@...>
- Date: 2012年6月13日 18:14:13 +0100
On 13 June 2012 17:35, Roberto Ierusalimschy <roberto@inf.puc-rio.br> 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[1] and Lua programmes would become more
complicated[2] or are these views now outdated?
Liam
[1] http://www.lua.org/doc/hopl.pdf
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.
[2] http://www.lua.org/semish94.html
This coercion is useful because it simplifies programs and avoids the
need for explicit conversion functions.