C++ Logo

std-proposals

Advanced search

Re: Initialisers in ternary operators

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Fri, 11 Sep 2020 17:37:07 -0400
On Fri, Sep 11, 2020 at 5:13 PM Ville Voutilainen via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> On Sat, 12 Sep 2020 at 00:09, Christof Meerwald via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> > > I suspect the biggest problems would be:
> > > a) convincing everyone that the existing lambda syntax is not sufficient
> >
> > http://wg21.link/p0977 will likely be brought up here
>
> Well, that's certainly not my favorite reference, but here's the thing:
> 1) tell me why gcc's expression-statements need to be brought into
> C++, when lambdas can do all the expression-statements can do
> 2) make sure to find out a) whether they were considered by the
> authors of c++0x lambdas b) and if so, why they were not proposed.

I would also suggest a third thing that needs to be looked at:
alternative syntax. Because as Christof noted, `{1, 2}` and `{1, 2;}`
are very different things under this idea, yet they do not immediately
appear to be. It's not entirely difficult to write the wrong one in
some location using `auto` deduction that just so happens to compile.
`{}` notation within certain locations already means "initialize an
object", so having syntax that's so similar means something so very
different is probably something that should be looked at closely.

That is, if braces really are the best syntax for this, it'd be good
to have an examination of what the not-best syntaxes are to establish
why they're the best.

Received on 2020-09-11 16:40:48