C++ Logo

std-proposals

Advanced search

Re: [std-proposals] if !(condition)

From: Jens Maurer <jens.maurer_at_[hidden]>
Date: Sun, 21 Apr 2024 00:22:31 +0200
On 20/04/2024 23.50, Yexuan Xiao wrote:
> I think your question is unfair, so I didn’t answer it.

If a pure alleged syntax beautification (and that's what this proposal is)
is not going to yield a benefit in token count or brevity or idiomatic
expression for a large proportion of cases, that's an important consideration
for me. I'm not seeing anything "unfair" about that.

> There are many features in C++ that are rarely used, yet they still exist in the standard.

Sure.

> My proposal won’t make any code ill-formed; I’m only concerned with the parts that can be improved by my proposal, namely the 3,800 instances in LLVM and GCC—that’s what’s meaningful. Also, this new syntax could be applied in other common situations, which means if GCC and LLVM adopt it, *it won’t be limited to just the 3,800 instances*​. In Ruby Rails, the usage rate of ‘unless’ is close to 1/5th of ‘if’, which is the upper limit for this syntax’s usage rate.

C++ is already a very complex language. Every tiny bit of extra
syntax we add on top, makes C++ a little more complex.

Thus, for every proposal, there is a cost/benefit ratio
that I consider to determine my opinion on that proposal.
I think I have a rough idea about the (mental) costs here,
and I have a rough idea about the benefits, which I consider
very small.

Jens

Received on 2024-04-20 22:22:48