<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class="">In theory, patterns can be combined with AND and OR to produce new patterns, if their target types and binding lists are compatible.  Note also that most fallthroughs (those where the case labels immediately follow other case labels, with no intervening statements) can be expressed as OR patterns.  </font></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><br class=""></font></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class="">Some form of OR patterns are almost a forced move if we want to have expression switches with patterns:</font></span></div><font face="Menlo" class=""><tt style="background-color: rgb(255, 255, 255);" class=""><br class="">    int numLetters = switch(s) {<br class="">        case "one", "two" -> 3;<br class="">        case "three" -> 5;<br class="">        ...<br class="">    }<br class=""><br class="">Because, while statement switches can simply repeat the labels:<br class=""><br class="">    case "one":<br class="">    case "two":<br class=""><br class="">this idiom looks pretty stupid if we try to transplant it to expression switches:<br class=""><br class="">    case "one" -><br class="">    case "two" -> wtf?<br class=""><br class="">OR patterns give us much of what fallthrough gives us; the only difference is the ability to have intervening statements between the case labels.  Given that expression switches push us towards OR patterns, why not double down, using this for statement switches, and prohibit fallthrough for statement switches too?  This is simpler and covers what seem like the important cases.  </tt></font><div class=""><div class=""><font face="Menlo" class=""><tt style="background-color: rgb(255, 255, 255);" class=""><br class=""></tt></font></div><div class=""><tt style="background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class="">In theory, an OR pattern of P and Q would require that both P and Q are applicable to the static type of the target, and (in the most strict interpretation) have identical binding variable lists. </font></tt></div><div class=""><tt style="background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><br class=""></font></tt></div><div class=""><span style="background-color: rgb(255, 255, 255); font-family: Menlo;" class="">Note that we have a form of OR patterns now, with multi-catch:</span></div><div class=""><br style="font-family: monospace; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" style="background-color: rgb(255, 255, 255);" class="">    catch (E1 | E2 identifier)</font><br style="font-family: monospace; background-color: rgb(255, 255, 255);" class=""><br style="font-family: monospace; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" style="background-color: rgb(255, 255, 255);" class="">Though, this might not really be what we want an OR pattern to look like, as this looks like the OR of "E1" (no bindings) and "E2" (with bindings), which would fail our restriction on the binding variable lists being the same.  An OR pattern would more correctly be written (E1 e | E2 e).  (However, we could interpret “E1|E2 identifier” as a union type-test pattern if we wanted to unify catch with patterns.)</font></div><div class=""><font face="Menlo" class=""><tt style="background-color: rgb(255, 255, 255);" class=""><br class=""></tt></font></div><div class=""><font face="Menlo" style="background-color: rgb(255, 255, 255);" class="">The big question is whether we need OR patterns at all, or whether this is merely an artifact of the switch statement.  For the matches expression, we can express ORs clearly enough without it:</font><br style="font-family: monospace; background-color: rgb(255, 255, 255);" class=""><br style="font-family: monospace; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" style="background-color: rgb(255, 255, 255);" class="">    if (x matches P || x matches Q)</font><br style="font-family: monospace; background-color: rgb(255, 255, 255);" class=""><br style="font-family: monospace; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" style="background-color: rgb(255, 255, 255);" class="">(and we need to support this anyway.)  If we used comma to separate patterns:</font><br style="font-family: monospace; background-color: rgb(255, 255, 255);" class=""><br style="font-family: monospace; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" style="background-color: rgb(255, 255, 255);" class="">    case 1, 2, 3: </font><br style="font-family: monospace; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" style="background-color: rgb(255, 255, 255);" class="">    case Foo x, Bar x, Baz x:</font><br style="font-family: monospace; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" style="background-color: rgb(255, 255, 255);" class="">    case Foo(var x), Bar(var x), Baz(var x): </font><br style="font-family: monospace; background-color: rgb(255, 255, 255);" class=""><br style="font-family: monospace; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" style="background-color: rgb(255, 255, 255);" class="">Is that clear enough?  Is that unambiguous enough?  If this works, this is nice because it works cleanly with existing constant switches too.  I think this is pretty good.  </font><br style="font-family: monospace; background-color: rgb(255, 255, 255);" class=""><span style="font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><br class=""></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class="">So, concrete proposal:</font></span></div><div class=""><font face="Menlo" class=""><tt style="background-color: rgb(255, 255, 255);" class=""><b class=""> - Allow multiple patterns to be separated by commas in a case label;</b></tt></font></div><div class=""><tt style="background-color: rgb(255, 255, 255);" class=""><b class=""><font face="Menlo" class=""> - Treat </font>“<font face="Menlo" class="">case X: case Y:” as sugar for “case  X, Y:” in statement switches;</font></b></tt></div><div class=""><tt style="background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><b class=""> - Impose the “same bindings” rule when multiple patterns are combined in this way;</b></font></tt></div><div class=""><tt style="background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><b class=""> - Disallow fall through into patterns with binding variables. </b></font></tt></div><div class=""><tt style="background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><br class=""></font></tt></div><div class=""><tt style="background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class="">Note that we don’t have to create a new kind of switch here to prohibit fall through; we just don’t allow fall through into non-constant pattern cases.  <br class=""></font></tt></div></div><div class=""><tt style="background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><br class=""></font></tt></div><div class=""><div class=""><tt style="background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class="">Note that Scala lets you OR multiple patterns together:</font><br class=""></tt><br style="background-color: rgb(255, 255, 255);" class=""><pre class="prettyprinted lang-scala prettyprint" style="margin-top: 0px; padding: 5px; border: 0px; font-variant-ligatures: normal; font-variant-numeric: inherit; font-stretch: inherit; font-size: 13px; line-height: inherit; vertical-align: baseline; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); color: rgb(57, 51, 24); word-wrap: normal; orphans: 2; widows: 2;"><code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; white-space: inherit;" class=""><font face="Menlo" class=""><span class="kwd" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(16, 16, 148);">def</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);"> matcher</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">(</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">l</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">:</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);"> </span><span class="typ" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(43, 145, 175);">Foo</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">):</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);"> </span><span class="typ" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(43, 145, 175);">String</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);"> </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">=</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);"> </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">{</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">
  l </span><span class="kwd" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(16, 16, 148);">match</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);"> </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">{</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">
    </span><span class="kwd" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(16, 16, 148);">case</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);"> A</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">()</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);"> </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">=></span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);"> </span><span class="str" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(125, 39, 39);">"A"</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">
    </span><span class="kwd" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(16, 16, 148);">case</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);"> B</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">(</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">_</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">)</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);"> </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">|</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);"> C</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">(</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">_</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">)</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);"> </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">=></span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);"> </span><span class="str" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(125, 39, 39);">"B"</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">
    </span><span class="kwd" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(16, 16, 148);">case</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);"> _ </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">=></span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);"> </span><span class="str" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(125, 39, 39);">"default"</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">
  </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">}</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">
</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">}</span></font></code></pre><font face="Menlo" class=""><tt style="background-color: rgb(255, 255, 255);" class="">but I'm not sure whether this is really an OR on patterns, or whether this is a "feature" of match?  But, this seems a pretty questionable syntax choice, as:<br class=""><br class=""></tt><span style="background-color: rgb(255, 255, 255);" class=""></span></font><blockquote style="background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class=""><tt class="">scala> 1 match {</tt><br class=""><tt class="">     | case 1 | 2 => "one";</tt><br class=""><tt class="">     | }</tt><br class=""><tt class="">res0: String = one</tt><br class=""><br class=""><tt class="">scala> 1 | 2</tt><br class=""><tt class="">res1: Int = 3</tt><br class=""></font></blockquote><tt style="background-color: rgb(255, 255, 255);" class=""><font face="Menlo" class="">So, even though 1|2 is an integer constant whose value is 3, "case 1|2" is an OR pattern.  <br class=""><br class=""><br class="">Similarly, its even less clear that we need AND patterns.  Though I could imagine wanting intersection type-test patterns, like:<br class=""><br class="">    switch (lambda) {<br class="">        case Predicate p && Serializable: ...<br class="">        case Predicate p: ...<br class="">    }<br class=""><br class="">Are there compelling use cases for AND patterns that I’m missing?  <br class=""><br class=""></font><br class=""></tt></div></div></body></html>