C++ Logo

std-proposals

Advanced search

Re: [std-proposals] return if

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Mon, 12 Jan 2026 13:20:04 +0000
On Mon, Jan 12, 2026 at 11:22 AM Filip wrote:
>
> Maybe instead of using keywords as modifiers we should talk about
> introducing a new keyword return_if which would do the early return.


But then we're adding a new keyword or a new "identifier with a
special meaning".

I think "return if" is pretty easy . . . the compiler just has to
treat the regex "return\s+if\s+" as a unique keyword and treat it
totally differently to "return\s+(?!if\b)". I realise that the
compiler internals don't use regex for this stuff but I'm trying to
express that it's possible to treat "return if" totally differently to
"return + something other than if".

Received on 2026-01-12 13:20:17