----- Original Message ----- > From: "daniel smith" <[email protected]> > To: "Remi Forax" <[email protected]> > Cc: "Brian Goetz" <[email protected]>, "Gavin Bierman" > <[email protected]>, "amber-spec-experts" > <[email protected]> > Sent: Friday, October 28, 2022 12:11:49 AM > Subject: Re: Draft Spec for Fourth Preview of Pattern Matching for Switch > (JEP 433) and Second Preview of Record > Patterns (JEP 432) now available
>> On Oct 27, 2022, at 3:03 PM, [email protected] wrote: >> >> ----- Original Message ----- >>> From: "daniel smith" <[email protected]> >>> To: "Remi Forax" <[email protected]> >>> Cc: "Brian Goetz" <[email protected]>, "Gavin Bierman" >>> <[email protected]>, "amber-spec-experts" >>> <[email protected]> >>> Sent: Thursday, October 27, 2022 11:51:23 PM >>> Subject: Re: Draft Spec for Fourth Preview of Pattern Matching for Switch >>> (JEP >>> 433) and Second Preview of Record >>> Patterns (JEP 432) now available >> >>>> On Oct 22, 2022, at 2:52 PM, [email protected] wrote: >>>> >>>> If i modify a record by adding a new component, i want to compiler to help >>>> me to >>>> find all the switches that are using that record so i can re-evaulate if >>>> the >>>> new component play a role or not for each of those codes. >>> >>> Maybe I'm missing something, but doesn't it do this already? >> >> yes, but with the proposed semantics, it's not possible to extract the record >> instance AND have the length of the record component list checked. >> >> Either i can use >> case Point p -> >> >> or >> case Point(var x, var y) -> >> >> but this is not valid anymore >> case Point(var x, var y) p -> ... > > Can always do this, right? > > case Point p where p instanceof Point(var x, var y) -> Gavin already proposed that, in France, we have a sentence for that Why do it the easy way when you can do it the hard way ? [1] moreover this pattern+where is not exhaustive on Point. Rémi [1] https://en.wikipedia.org/wiki/Les_Shadoks
