On Thu, 4 May 2023 at 09:53, David Brown via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
On 04/05/2023 10:10, Jonathan Wakely via Std-Proposals wrote:
>
>
> On Thu, 4 May 2023, 08:35 Sebastian Wittmeier via Std-Proposals,
> <std-proposals@lists.isocpp.org <mailto:std-proposals@lists.isocpp.org>>
> wrote:
>
>     __
>
>         -----Ursprüngliche Nachricht-----
>         *Von:*        Simon Hill via Std-Proposals
>         <std-proposals@lists.isocpp.org
>         <mailto:std-proposals@lists.isocpp.org>>
>         *Gesendet:*   Mi 03.05.2023 17:21
>         *Betreff:*    Re: [std-proposals] New draft proposal: Add "%s"
>         (two-digit truncated-integer seconds) as a std::format
>         conversion specifier for std::chrono time types.
>         *An:* std-proposals@lists.isocpp.org
>         <mailto:std-proposals@lists.isocpp.org>;
>         *CC:* Simon Hill <protogrammer@gmx.com
>         <mailto:protogrammer@gmx.com>>;
>         But people learn that a single logical operator is bitwise, and
>         a double logical operator is boolean. They then have to remember
>         that ^ doesn't have a bitwise equivalent.
>
>     ^ is already bitwise. You mean ^ has no logical equivalent?
>
>     Some logical operators use doubled symbols, some not.
>
>     && and || specifically stand for the short-circuit evaluation.
>
>     Otherwise for consistency one would want to introduce !! instead of
>     ! for logical NOT, which would lead to a lot of confusion and faulty
>     programs.
>
>
> OK I lied, I do have an opinion on this...
>
> ^^ looks like it could be an exponentiation operator to me, and
> apparently Haskell and D use it for that. And if we added the ability to
> overload operator^^ then I'm pretty sure people would start abusing it
> for exponentiation (because there's no operator** in C++).

If anyone wanted to add ^^ to the language for logical xor, it would
probably be best first to introduce ** for exponentiation, and then
later ^^ could be added without that confusion.

>
> If somewhat confusing, terse syntax is preferable to bool(x)^bool(y)
> then you can already do !x != !y. But I'd just use != for this operation
> on booleans anyway, not xor (whether in single or double form).

You can also do "!!x ^ !!y", using the "convert to bool operator" !!.
Alternatively, "!x ^ !y" saves two keypresses :-)

>
>
> I think new operators need a much more compelling justification than
> being a bit less verbose than existing solutions.
>

I think it would be nice to be able to make your own operators (as you
can in some languages), using combinations of existing punctuation and
Unicode characters.  People would be able to make vector classes and
write "a × b" and "a · b", or set classes with "a ∩ b" and "a ∪ b".
(Library authors would be encouraged to provide alternative text forms,
in the manner of "bitand".)  And in particular, it would mean that
things like "**" for exponentiation could be added as a library feature
rather than a language change.

All that's needed are massive changes to the way the language is parsed...

Reflection.