On Mar 9, 2021, at 12:23 PM, John Rose <john.r.r...@oracle.com> wrote: > > If switch refactors > to an if-chain, why then continue-switch would refactor to > continue-if, which turns out to branch to the next “else”, > if any.
A bit more detail in case that was cryptic: switch (obj) { ... case P &&guard G: … … } <=refactor=> switch (obj) { ... case P: { if (!G) continue switch; } ... … } <=refactor=> val $it = obj; if ... else if ($it instanceof P && G) { ... } else … <=refactor=> val $it = obj; if ... else if ($it instanceof P) { { if (!G) continue if; } ... } else … (No sub-cases here, BTW.) The enhanced continue statement allows guards to be refactored to interact with ad hoc variable bindings and/or control flow as: switch (obj) { ... case P: if (Q) return quickwin(); var X = …; if (!G(X)) continue switch; ... … } Still, the above does not yet seem to constitute any killer use cases. Also, frankly, “continue if” is probably liable to bad abuses.