[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Are automatic coercions ever going away?
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 28 Jul 2014 18:01:19 +0200
2014-07-28 16:52 GMT+02:00 Steven Degutis <sbdegutis@gmail.com>:
> I've been reading Programming in Lua third edition (excellent book by the
> way!) and the section about Coercions in Chapter 2 (Types and Values)
> mentions that the authors of Lua today believe that automatic coercions
> between numbers and strings are maybe not such a good idea, and recommends
> not using them. He also says that these coercions add complexity to the
> language.
>
> Is there any plan to remove these from the language at some point? It would
> allow the authors to simplify the language, as well as remove the
> possibility yet another type of user error. I understand the removal process
> involves deprecation as a first-step, but I also understand that Lua is not
> afraid to break a little backwards-compatibility now and then for the sake
> of simplifying the language.
It may well be that "10" + "7" will pretty soon become illegal unless there
is a metamethod, but 10..7 will evaluate to "107" for the foreseeable future.
It was discussed somewhere in one of the Lua 5.3 work threads, but I am
just as lazy as you when it comes to searching the archive on lua-users.org.