Re: Effect cases in switch

2023-12-18 Thread Brian Goetz
Turning to Remi's other comments: these are basically about interaction of this feature with the two throw-related features that came in in Java 7 -- multi-catch and try-with-resources. In Java 7 we got multi-catch; you can say    catch (E1|E2 e) { ... } There are several problems with

Re: Effect cases in switch

2023-12-14 Thread Brian Goetz
One of the many reasons in-args should be effectively final. On 12/14/2023 2:16 AM, John Rose wrote: P.S. If we ever get in-args into patterns it gets even more wooly, since those would be little expressions embedded in random places in the case patterns, and would be evaluated at

Re: Effect cases in switch

2023-12-13 Thread John Rose
On 12 Dec 2023, at 14:41, Remi Forax wrote: … I don't want to be the guy implementing this :) Your proposal is fighting against the physics of the VM, when you enter in an exception handler (a catch block) With my VM hat on I wrote something on another thread about this. You can either

Re: Effect cases in switch

2023-12-13 Thread forax
> From: "Brian Goetz" > To: "Remi Forax" > Cc: "amber-spec-experts" > Sent: Wednesday, December 13, 2023 12:04:09 AM > Subject: Re: Effect cases in switch >>> Exception cases can be used in all forms of `switch`: expression and >>&g

Re: Effect cases in switch

2023-12-12 Thread Brian Goetz
Exception cases can be used in all forms of `switch`: expression and statement switches, switches that use traditional (colon) or single-consequence (arrow) case labels.  Exception cases can have guards like any other pattern case. I think I would prefer "case

Re: Effect cases in switch

2023-12-12 Thread Archie Cobbs
On Tue, Dec 12, 2023 at 4:41 PM Remi Forax wrote: > Your proposal is fighting against the physics of the VM, when you enter in > an exception handler (a catch block), the whole stack disapear so you need > some compiler magic to store everything which is on stack into locals > before calling a

Re: Effect cases in switch

2023-12-12 Thread Remi Forax
> From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Tuesday, December 12, 2023 10:23:09 PM > Subject: Effect cases in switch > Based on some inspiration from OCaml, and given that the significant upgrades > to > switch so far position it to do a

Effect cases in switch

2023-12-12 Thread Brian Goetz
Based on some inspiration from OCaml, and given that the significant upgrades to switch so far position it to do a lot more than it could before, we've been exploring a further refinement of switch to incorporate failure handling as well. (I realize that this may elicit strong reactions from