Why is there no or or and ?

James Miller james at aatch.net
Fri Feb 17 06:02:04 PST 2012


On 18 February 2012 02:35, David <d at dav1d.de> wrote:
>> Python also uses "&" for set intersection afaik.
>
>
> Yes, but that's an overload of the &-Operator and it makes sense.
>
>
> We should add "and" and "or" this makes the Code way more readable, imo.

But I spent years learning && and ||, when I read code, these patterns
jump out at me. Sure they aren't as "readable" but we're writing a
program here, not the Illiad. I write in a programming language, not
english, if I wanted to write in english, I'd go be an author, or a
journalist.

As people have mentioned, it only makes the code more readable (and
even that is under debate) for english-speaking users, foreign
language users are at even more of a disadvantage, since the have an
extra step of analysis to figure out what it means, especially since
there might not always be a simple translation.

Don't think of && and || as `and` and `or`, think of them more as
logical conjuction and disjunction, they are predicate operators.

And if we want to get into "proper" symbols for logic, we should be
using ∧, ∨, ⊕, ¬ for and, or, exclusive or and not, since those are
the proper boolean algebra symbols.

--
James Miller


More information about the Digitalmars-d mailing list