Section Do we need constant patterns,
if we don't have constant pattern, it may also means that the type of a bound
variables can be implicit too.
i.e. case Point(x, y) having the same meaning as case Point(var x, var y) like
with lambdas.
Because
int c = ...
switch(getFoo()) {
case Foo(c): ...
}
is not valid anymore and should be written like this
int c = ...
switch(getFoo()) {
case Foo(x) where x == c: ...
}
Rémi
> De: "Brian Goetz" <[email protected]>
> À: "amber-spec-experts" <[email protected]>
> Envoyé: Mardi 8 Septembre 2020 18:43:01
> Objet: Updated patterns-in-switch doc
> I have updated
> [
> https://github.com/openjdk/amber-docs/blob/master/site/design-notes/type-patterns-in-switch.md
> |
> https://github.com/openjdk/amber-docs/blob/master/site/design-notes/type-patterns-in-switch.md
> ]
> based on our discussions.