The lambda (with default capture by reference) looks like a good (existing) option to me.

On Friday, August 16, 2019, 6:51:44 PM CDT, Arthur O'Dwyer <arthur.j.odwyer@gmail.com> wrote:


On Fri, Aug 16, 2019 at 7:43 PM Walt Karas via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
Another option would be to redefine 'break' as a void-returning expression, so that:

do { /* yada */ } while (0);

could become:

for ( ; ; break) { /* yada */ }

It's more readable if you know a loop isn't really a loop from the beginning.

Once you're making up new meanings for control-flow keywords, what would be wrong with

    {
        /* yada */
        if (something) goto bottom;
        /* yada */
    }
    bottom:;

or

    []() {
        /* yada */
        if (something) return;
        /* yada */
    }();

? C++ already has plenty of ways to spell "goto this place" and/or "break out of this level of nesting"; I don't think we need more.

"goto case" and "goto default", on the other hand, should probably Just Work. Try to get buy-in from a compiler vendor. I wouldn't want to waste paper verbiage on them before showing that they can be useful in practice.

my $.02,
–Arthur