Comments/Feature Requests regarding JEP 305: Pattern Matching

John Rose john.r.rose at
Thu Jul 6 22:48:24 UTC 2017

On Jul 6, 2017, at 11:27 AM, Brian Goetz <brian.goetz at> wrote:
> A variant of #2 would be to allow the user to explicitly re-use (and hence shadow) the target:
>    switch (p) {
>        case Integer p:
>        case Double p:
>        case Float p:
>    }
> We might consider that, as it is in line with another shadowing-related change we're making as part of Lambda Leftovers.

+10 on this.  It is "poor man's flow-typing", and the explicit separate bindings
remove a bunch of unpleasant complexity that real flow-typing suffers from.

(BTW:  The new p bindings are all 'final', right?  You can't say "p=q" later on
in the switch, and then get surprised about the resulting paradoxes.)

— John

More information about the amber-dev mailing list