lua-users home
lua-l archive

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


On 7/28/2014 12:32 PM, Coda Highland wrote:
On Mon, Jul 28, 2014 at 12:15 PM, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
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.

/s/ Adam

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.