[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Arithmetic on strings
- From: Enrico Colombini <erix@...>
- Date: Sat, 07 Jul 2012 16:47:29 +0200
On 07/07/2012 16.22, Andrew Starks wrote:
I think that all coercion should be out of the language, including the
coercion of nil to false.
I think nil evaluating to false in boolean expressions is just too
convenient to lose, e.g. when checking if a value exists or is valid, or
in ternary expressions (a and b or c).
Having to check for equality to nil (or using "exists()") would add a
substantial amount of code and make it less readable, increasing the
probability of mistakes.
To be clear: in C++ I prefer to avoid "if(v)" when v is not a boolean,
but in Lua I use it routinely.