Re: Fwd: switch-case-catch

2021-07-20 Thread Brian Goetz
After a few minutes more thought, this approach can be simulated pretty well by a library solution. Suppose you wrote the following class (once):     sealed class Result {     record Succ(T t) extends Result { }     record Fail(E e) extends Result { }     interface

Fwd: switch-case-catch

2021-07-20 Thread Brian Goetz
The following idea was received on amber-spec-comments. Essentially, the OP is asking that, if we're extending switch to cover more different kinds of cases, why not further extend it to treat an exception in evaluating the target as another kind of matchable result.  It is a little like the

Re: [External] : Re: case null and type pattern

2021-07-20 Thread forax
> From: "Brian Goetz" > To: "Remi Forax" > Cc: "Gavin Bierman" , "Manoj Palat" > , "amber-spec-experts" > > Sent: Lundi 19 Juillet 2021 15:49:22 > Subject: Re: [External] : Re: case null and type pattern > Sure, but again, I think users would find that restriction even more annoying; > the