[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.3: 1 Month of use
- From: joao lobato <btnfdp.lobato@...>
- Date: Tue, 4 Mar 2014 14:06:59 +0000
On 04/03/2014, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2014-03-04 11:27 GMT+02:00 Pierre Chapuis <catwell@archlinux.us>:
>
>> I think Lua 5.3 may be a good time to remove all coercion from string
>> to number and from number to string from the language.
>
> String to number, yes. Number to string, no.
>
>> It means you should not be able to do this:
>>
>> answer = "6" * 7
>
> One can always define metamethods for strings, so I can live with this.
>
>> or this:
>>
>> print(string.format("the answer is %s", 42))
>>
>
> Actually "%s" allows anything. The Lua equivalent of Python "%r".
>
>> print(string.format("%s",io.stdin))
> file (0xb7719ac0)
>
>
Perhaps "%s" should explicitly mean "invoke tostring on this".
(Maybe it already does :-) )