<div dir="ltr"><div><snip></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div id="m_1608123405137719774zimbraEditorContainer" style="font-family:arial,helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"><div><div><br></div><div>So my main concern stay that<br></div><div>  String s = ...<br></div><div>  switch(s) {<br></div><div>    case Comparable<?> c -> ... //Dan: matches here as String implements Comparable (this case is total on "s" so no further matching)<br></div><div>    case Object o -> ...<br></div><div>  }<br></div><div><br></div><div>and<br></div><div>  long l = ...<br></div><div>  switch(l) {<br></div><div>    case float f -> ...  //Dan: matches here if l is convertable to a float<br></div><div>    case double d -> ... //Dan: otherwise matches here<br></div><div>  }<br></div><div><br></div><div>behave differently.<br></div><div><br></div></div></div></div></blockquote><div><br></div><div>In each case, we're finding the switch case that the value is compatible with.  Another way to say it is the value is convertable to... or castable to.  Can you expand on what you mean by "behave differently"?</div><div><br></div><div>I'm still working on reading through the "big picture" presentation in [0] so if there's a particular section there that you think is relevant, I can re-read that first.  It might be useful for both of us to re-read it and see how this example fits with the bigger picture being proposed for pattern matching.</div><div><br></div><div>--Dan</div><div><br></div><div>[0] <a href="https://openjdk.org/projects/amber/design-notes/patterns/pattern-match-object-model">https://openjdk.org/projects/amber/design-notes/patterns/pattern-match-object-model</a></div></div></div>