lua-users home
lua-l archive

Re: Strings and metamethods (Was: A guide to building Lua modules)

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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.)

AltStyle によって変換されたページ (->オリジナル) /