C++ Logo

std-proposals

Advanced search

Re: [std-proposals] return if

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Mon, 12 Jan 2026 12:56:38 +0000
On Mon, Jan 12, 2026 at 9:28 AM David Brown wrote:
>
> However, I /really/ dislike your syntax here, precisely because it is
> not at all clear or readable. There are so many different ways this
> syntax could reasonably be interpreted when reading it:


Yeah if the reader has never seen "return if" before, then they won't
be sure what does . . . they'll be wondering if it returns bool or
if it returns decltype( callee() ).

But human written language is nearly always a little ambiguous when we
don't have context, especially in "telegraph speak" where we rip out
all the unnecessary words, e.g. "man found boat capsized need medic"

If the feature, "return if", were to be added to the language, give it
a few months, maybe a year two, and everyone will recognise it at a
glance.

Received on 2026-01-12 12:56:51