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 ExceptionalSuppl

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 c