Copied from wiki4d as it makes a lot of sense from a completeness and consistency standpoint:
The <nowiki>XorXor</nowiki> (^^) operator would relate to the <nowiki>OrOr</nowiki> "||" and <nowiki>AndAnd</nowiki> "&&" operators in the same way that the bit wize xor "^" operator relates to bit wize Or "|" and And "&"
if (paper ^^ plastic)
{
bag(items);
}
Comment #1 by bugzilla — 2006-05-25T04:30:12Z
A request for this operator often comes up in the C/C++ forums. The general consensus is that the need for this comes up relatively rarely, and the == operator can fill the role adequately, as in:
(paper != 0) == (plastic != 0)
Comment #2 by wbaxter — 2006-11-03T07:23:42Z
(In reply to comment #1)
> A request for this operator often comes up in the C/C++ forums. The general
> consensus is that the need for this comes up relatively rarely, and the ==
> operator can fill the role adequately, as in:
>
> (paper != 0) == (plastic != 0)
>
The funny thing is that this proposed replacement is wrong. It should be
(paper != 0) != (plastic != 0)
That the creator of the D language made such a mistake, and that it has stood for many months without comment, suggests to me that maybe ^^ is not such a bad idea after all.
Comment #3 by smjg — 2006-11-03T08:05:51Z
Indeed, ? ... : is an adequate substitute for && and ||. So why should this be any different?