Date: Mon, 01 Jun 2026 19:41:10 -0700
On Monday, 1 June 2026 14:41:15 Pacific Daylight Time Frederick Virchanza
Gotham via Std-Proposals wrote:
> Well the unary operator '%' is programmed to become "classalloca( )",
> so you can write "classalloca( std::async( EntryPoint ) )" instead of
> "%std::async(EntryPoint)".
>
> I think the unary operator is cool for this though. Like how
> structured bindings didn't add any functionality at all to the
> language but were just deemed cool enough to make it in.
There is only one symbolic operator added to C++ since its inception, and
that's the spaceship one. Even compared to C, the only symbolic differences are
the scope operator (which is not really an operator since at least the left
side can't be a variable) and the two pointer-to-member accessors .* and ->*.
Adding unary % needs to have REALLY strong motivation and a good analysis of
whether it may fall afoul of existing syntax. So think about whether it's
really required or is just a nifty thing you came up with. How often is it
going to be used? Is it worth modifying the language syntax for it? How
teachable is it? Would it make more sense to spell out (imagine if we had used
unary % to mean "alignof")?
Gotham via Std-Proposals wrote:
> Well the unary operator '%' is programmed to become "classalloca( )",
> so you can write "classalloca( std::async( EntryPoint ) )" instead of
> "%std::async(EntryPoint)".
>
> I think the unary operator is cool for this though. Like how
> structured bindings didn't add any functionality at all to the
> language but were just deemed cool enough to make it in.
There is only one symbolic operator added to C++ since its inception, and
that's the spaceship one. Even compared to C, the only symbolic differences are
the scope operator (which is not really an operator since at least the left
side can't be a variable) and the two pointer-to-member accessors .* and ->*.
Adding unary % needs to have REALLY strong motivation and a good analysis of
whether it may fall afoul of existing syntax. So think about whether it's
really required or is just a nifty thing you came up with. How often is it
going to be used? Is it worth modifying the language syntax for it? How
teachable is it? Would it make more sense to spell out (imagine if we had used
unary % to mean "alignof")?
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Principal Engineer - Intel Data Center - Platform & Sys. Eng.
Received on 2026-06-02 02:41:33
