Date: Thu, 4 May 2023 06:27:59 -0500
On Thu, May 4, 2023, 04:47 Timur Doumler via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> I don't think we could ever have operator** because ** has a meaning in
> C++ today (multiplication followed by dereference, or double dereference).
> Am I missing something?
>
Deprecate ** in one cycle, make it an operator token in the next. Like we
did for [,].
Cheers,
> Timur
>
> > On 4 May 2023, at 11:53, David Brown via Std-Proposals <
> std-proposals_at_[hidden]> 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_at_[hidden] <mailto:std-proposals_at_[hidden]>>
> wrote:
> >> __
> >> -----Ursprüngliche Nachricht-----
> >> *Von:* Simon Hill via Std-Proposals
> >> <std-proposals_at_[hidden]
> >> <mailto:std-proposals_at_[hidden]>>
> >> *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_at_[hidden]
> >> <mailto:std-proposals_at_[hidden]>;
> >> *CC:* Simon Hill <protogrammer_at_[hidden]
> >> <mailto:protogrammer_at_[hidden]>>;
> >> 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...
> >
> >
> > --
> > Std-Proposals mailing list
> > Std-Proposals_at_[hidden]
> > https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
std-proposals_at_[hidden]> wrote:
> I don't think we could ever have operator** because ** has a meaning in
> C++ today (multiplication followed by dereference, or double dereference).
> Am I missing something?
>
Deprecate ** in one cycle, make it an operator token in the next. Like we
did for [,].
Cheers,
> Timur
>
> > On 4 May 2023, at 11:53, David Brown via Std-Proposals <
> std-proposals_at_[hidden]> 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_at_[hidden] <mailto:std-proposals_at_[hidden]>>
> wrote:
> >> __
> >> -----Ursprüngliche Nachricht-----
> >> *Von:* Simon Hill via Std-Proposals
> >> <std-proposals_at_[hidden]
> >> <mailto:std-proposals_at_[hidden]>>
> >> *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_at_[hidden]
> >> <mailto:std-proposals_at_[hidden]>;
> >> *CC:* Simon Hill <protogrammer_at_[hidden]
> >> <mailto:protogrammer_at_[hidden]>>;
> >> 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...
> >
> >
> > --
> > Std-Proposals mailing list
> > Std-Proposals_at_[hidden]
> > https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
Received on 2023-05-04 11:28:13