[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Is string always same as number? (the consistency of lua)
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 10 Feb 2011 12:00:00 +0200
On Thu, Feb 10, 2011 at 11:42 AM, Axel Kittenberger <axkibe@gmail.com> wrote:
> function for the current core, but the implicity of stuff happening
> and the bugs that can spawn, like number string conversations is
> pretty bad.
They _are_ bad if '+' is overloaded to mean both concatenation and
addition, as in JavaScript.
For Lua, the coercions in a..b and a+b are pretty well defined, but of
course they may throw an error, and that's when explicit
tonumber/tostring is useful.
Even strong typed languages know the wisdom of automatic coercion to
string when the context demands it (e.g. string + in Java)
steve d.