New pattern matching doc

Brian Goetz brian.goetz at
Sat Jan 16 14:30:09 UTC 2021

It is possible, but I think it's too subtle.  Everything else about 
pattern matching and assignment goes out of its way to not throw on 
failure, and this would undermine both of those.  I think your earlier 
comment about "specifically ask for it" is right.  The exact syntax of 
"specifically asking" surely admits many possibilities, but I think this 
particular mode of asking seems a little too much (actually, too little.)

> There's no need to introduce new `try-match` syntax to opt into 
> assignment to partial patterns, you can just lean on rules that users 
> already understand. You ask for it simply by catching or throwing the 
> potential exception.
>     try {
> PartialPattern(var a) = blah;
>     } catch (MatchFailException e) {
>     }
> Is that not sufficient?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the amber-spec-experts mailing list