and/or/not/xor operators

bearophile bearophileHUGS at lycos.com
Thu May 30 19:02:43 PDT 2013


Shriramana Sharma:

> Um why really? "No one uses them in C++"? How come? I agree that
> Walter has succesfully produced/marketed a C++ compiler for a 
> long
> time, but really, "no one uses"?!!! I use, for one. And it does
> tremendously increase the readability of a program. Otherwise 
> why
> would there be a separate C header ever since 1990 for that:
> http://en.wikipedia.org/wiki/Iso646.h
>
> I agree that we should retain the old operators for C 
> compatibility
> but really at least the basic and/or/not/xor keywords should be
> provided.

I prefer the Python design here, it uses & | ^ for bitwise 
operators and and or not for the boolean operations. But I asked 
to Walter and that's the official answer I received.

Python doesn't support && || ! at all, so you are asking to 
introduce duplicated syntax in D.

In D learn we help newbies, discuss bugs in user code, library 
code or in the compiler, sometimes we even propose problems to 
solve or small functions to add to Phobos, but this is not the 
right newsgroup to ask for new D syntax. If you are passionate 
about your request, then you should ask about it in the main D 
newsgroup. But don't expect to receive a "yes sure!" as answer 
:-) If you think many C++ programmers are using or and not, then 
it's much better for you to show evidence. Just saying "I use 
it!" is (rightfully) not enough for Walter. I read enough C++ 
code, and I don't see them used often.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list