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?
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.)
- Re: New pattern matching doc forax
- Re: New pattern matching doc Brian Goetz
- Re: New pattern matching doc Remi Forax
- Re: New pattern matching doc Brian Goetz
- Re: New pattern matching doc Mark Raynsford
- Re: New pattern matching doc Brian Goetz
- Re: New pattern matching doc Brian Goetz
- Re: New pattern matching doc Mark Raynsford
- Re: New pattern matching doc Brian Goetz
- Re: New pattern matching doc Elias N Vasylenko
- Re: New pattern matching doc Brian Goetz
