lua-users home
lua-l archive

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


On Jul 7, 2012, at 6:44, Dirk Laurie <dirk.laurie@gmail.com> wrote:

> 2012/7/7 steve donovan <steve.j.donovan@gmail.com>:
>> On Sat, Jul 7, 2012 at 11:33 AM, Miles Bader <miles@gnu.org> wrote:
>>> Me too.
>>
>> Ditto. The code it breaks is code that's going to break 'by accident'
>> in some way later.
>>
>
> There's just one thing: input of numbers.  At present, I can write:
>
> s=0; k=0
> grade="Ann 57, Bob 64,Cat 77, Don 62, Eve 51"
> for n in grade:gmatch("%d+") do s=s+n; k=k+1 end
> print(s/k)
>
> I don't see this code breaking "by accident".
>
> Are we really going to improve quality-of-life for the public
> by fascistically taking away this freedom?
>
> I vote for this solution: remove string coercion, but make it
> easy to enable/disable the necessary metamethods that give
> the same effect.  For at least one release, let string coercion
> by metamethods still be the default.
>

I think that all coercion should be out of the language, including the
coercion of nil to false.

I also agree that all coercion should be allowed on all value types
throughmeta methods: tostring, tonumber, toboolean, totable. I think
that was the way, at some point, so there must have been a reason to
remove it.

Having only, for example, tostring, seems arbitrary to the ignorant (me).

-Andrew Starks