Composition of pattern questions

Brian Goetz brian.goetz at oracle.com
Thu Mar 4 15:29:48 UTC 2021


> What I was exploring is a syntax design space where guards are special
> but patterns can still be composed.

I think the root of your discomfort may be: we _already_ have a way to 
express guard-like constructs in instanceof using ordinary 
&&-composition, so this is really about switch, and that having to use 
_two_ features (& composition and true/false patterns) to get to a guard 
in a switch seems too roundabout, and you want something more direct?

> Guard:
>   : `when(` Expression `)`

Again: is it that using & to get to guards seems too roundabout?




More information about the amber-dev mailing list