lua-users home
lua-l archive

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


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 "~=".