[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Strings and metamethods (Was: A guide to building Lua modules)
- From: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 16 Apr 2014 10:53:29 +0200
2014-04-16 10:48 GMT+02:00 steve donovan <steve.j.donovan@gmail.com>:
> On Wed, Apr 16, 2014 at 10:41 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>> Quite an attractive idea now that we have so many new metamethods.
>> Unfortunately string-to-number coercion creates pretty Lua examples
>> for Gary Bernhardt's next talk on Wat.
>
> How strongly do people feel about string-to-number? It always felt
> like something that belongs in lesser languages. What is so hard
> about explicit tonumber()?
>
> Such a change would break some programs yes, but in a very obvious way.
Roberto has been talking about getting rid of it for a few years,
and the 5.3 manual already warns:
Lua also converts strings to numbers, whenever a number is expected.
(This conversion may be deprecated in future versions.)