Knocking off two more vestiges of legacy switch
Dan Heidinga
heidinga at redhat.com
Tue Sep 13 18:42:23 UTC 2022
<snip>
>
> So my main concern stay that
> String s = ...
> switch(s) {
> case Comparable<?> c -> ... //Dan: matches here as String implements
> Comparable (this case is total on "s" so no further matching)
> case Object o -> ...
> }
>
> and
> long l = ...
> switch(l) {
> case float f -> ... //Dan: matches here if l is convertable to a float
> case double d -> ... //Dan: otherwise matches here
> }
>
> behave differently.
>
>
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"?
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.
--Dan
[0]
https://openjdk.org/projects/amber/design-notes/patterns/pattern-match-object-model
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-spec-observers/attachments/20220913/63461135/attachment.htm>
More information about the amber-spec-observers
mailing list