[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Are automatic coercions ever going away?
- From: Mike Nelson <mikestar1313@...>
- Date: Mon, 28 Jul 2014 17:46:55 -0700
On 7/28/2014 12:32 PM, Coda Highland wrote:
This one is simple--make a copy of LuaV_tonumber with a new name (say
LuaV_explicittonumber or whatever) but the old code, then set "tonumber"
to a pointer to this new function. Explicit coercion via tonumber still
works, but implicit string to number coercions are removed, without
changing the various other code sites where LuaV_tonumber is called. I
believe that number to string coercions are not as easy to remove, but
also not as troublesome to leave them in. If say, it is decided to do a
very thorough code rewrite for Lua 6, definitely remove this
auto-conversion then: not to suggest that such a rewrite should or
shouldn't be done, that is purely the Lua authors' decision.
On Mon, Jul 28, 2014 at 12:15 PM, Luiz Henrique de Figueiredo
It sits rather deeply in the implementation. [...]
it is so troublesome that it has not been done yet
Not really. See http://lua-users.org/lists/lua-l/2014-03/msg00699.html
Breaking tonumber() isn't exactly the same thing as removing implicit
coercions -- it breaks explicit conversions too.