lua-users home
lua-l archive

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


I'd prefer to see ¬= myself.  Makes more sense to me than ~= and != both.


On 7 March 2013 22:32, Gavin Kistner <phrogz@me.com> wrote:
On Mar 6, 2013, at 10:01 PM, Miles Bader <miles@gnu.org> wrote:
> Philippe Lhoste <PhiLho@GMX.net> writes:
>> Funnily, I rarely see complains about using -- as in-line comment
>> symbol, or .. as string concatenation symbol.
>
> I find I use comments and string-concatenation so often they quickly
> became second-nature (Lua's comment syntax is also rather pretty,
> which is a nice plus).  For whatever reason, that doesn't seem to be
> true of inequality, at least for me.

This is also true for me, and I think it may have to do with the mismatch between unary negation and not equals.

In C/_javascript_/Java/Ruby/Io you use != for "not equals".
In C/_javascript_/Java/Ruby you use !a for "not a".
There is a nice mental symmetry here. The English word "not" and the programming "!" operators are equivalent.

Ruby and Lua and Io use "not" for logical negation. (Ruby allows both "not" and "!" with different precedence.)

But Lua is the only language I personally know that uses "~=" for not equals. It especially conflicts mentally for me with the Ruby "=~" operator which is used generally for pattern matching.

Python's "<>" for inequality is also strange to me, but not as strange as "~=".






--
"Perhaps people don't believe this, but throughout all of the discussions of entering China our focus has really been what's best for the Chinese people. It's not been about our revenue or profit or whatnot."
--Sergey Brin, demonstrating the emptiness of the "don't be evil" mantra.