Why is there no or or and ?

Marco Leise Marco.Leise at gmx.de
Fri Feb 17 08:26:46 PST 2012


Am 17.02.2012, 15:02 Uhr, schrieb James Miller <james at aatch.net>:

> 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

The only thing that I still mix up is = and ==. I wonder if it is just me or people who are used to Pascal syntax. I sometimes miss

	if a = 1 then a := 2;

which results in my bad mental C/D translation: if (a = 1) ...;


More information about the Digitalmars-d mailing list