[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Strange Operators (Was: Why I leave Lua)
- From: David Heiko Kolf <david@...>
- Date: Thu, 10 Jul 2014 20:59:49 +0200
Paige DePol wrote:
> On Jul 9, 2014, at 5:36 PM, Michel Martens <soveran@gmail.com> wrote:
>
>> On 9 July 2014 17:13, Tim Hill <drtimhill@gmail.com> wrote:
>>> Over the years I’ve used .NE. (FORTRAN, yes with the dots), <> with BASIC and dialects, != with C and dialects etc etc. I have no real trouble switching, though I make the odd typo. I’m a little sympathetic to those who point out that tilde is used for “approximate” in many math environments, so it reads a little oddly if you are aware of that. But I don’t think it’s a big deal.
>>
>> I'm lucky because my default shell is rc from plan9, where ~ is the
>> equality operator :-)
>
> I think something in my brain just popped, thanks! ;)
>
> So we have Lua and Matlab's ~= and `rc` from Plan9 using ~ for equality (why, oh why?!).
>
> What other strange operators have been spotted in the wild?
Even though I used it for many years and continue to use it, to me the C
equality operator '==' is strange. Double equal? And JavaScript has
triple equal: '==='.
To me the Pascal/Ada equality '=' and assignment ':=' operators look
much more familiar. I also like the Ada inequality operator '/=' which
is precisely what you would enter on an old typewriter to combine the
two characters into a real inequality operator.
Now I wonder why Lua is using the same syntax for comments as Ada does,
but not the equality, assignment and inequality operators. I don't
demand a change to that, though. ;-)
I also wonder why people complain about the inequality operator even
though C uses ~ for binary negation and hundreds of engineering students
learn to use ~= in Matlab, but I cannot remember a single case where
somebody complained about the weird double-equal in Lua...
Best regards,
David