Re: [External] : Re: Reviewing feedback on patterns in switch

2022-02-16 Thread Guy Steele
> On Feb 16, 2022, at 9:57 AM, Brian Goetz wrote: > . . . > What if I want to use a partial pattern, and then customize either the > throwing part or provide default values? I can provide an else clause: > > Object o = ... > let String s = o > else throw new NotStringException();

Re: [External] : Re: Reviewing feedback on patterns in switch

2022-02-16 Thread forax
> From: "Brian Goetz" > To: "Remi Forax" > Cc: "amber-spec-experts" > Sent: Wednesday, February 16, 2022 5:03:19 PM > Subject: Re: [External] : Re: Reviewing feedback on patterns in switch > Of course, in an ecosystem as diverse as Java develope

Re: [External] : Re: Reviewing feedback on patterns in switch

2022-02-16 Thread forax
> From: "Brian Goetz" > To: "Remi Forax" > Cc: "amber-spec-experts" > Sent: Wednesday, February 16, 2022 3:57:39 PM > Subject: Re: [External] : Re: Reviewing feedback on patterns in switch > OK, I'll make you a deal: I'll answer your

Re: [External] : Re: Reviewing feedback on patterns in switch

2022-02-16 Thread forax
> From: "Brian Goetz" > To: "Remi Forax" > Cc: "amber-spec-experts" > Sent: Wednesday, February 16, 2022 3:48:14 PM > Subject: Re: [External] : Re: Reviewing feedback on patterns in switch >> Not sure it's a no-brainer. >>

Re: [External] : Re: Reviewing feedback on patterns in switch

2022-02-16 Thread Brian Goetz
Of course, in an ecosystem as diverse as Java developers, one routinely expects to get complaints about both X and ~X.  Which makes it notable that we have not gotten any complaints about "why do you force me to write an empty default".  (I'm not complaining!) The case you raise -- legacy { sw

Re: [External] : Re: Reviewing feedback on patterns in switch

2022-02-16 Thread Brian Goetz
OK, I'll make you a deal: I'll answer your question about let/bind, under the condition that we not divert the discussion on that right now -- there'll be a proper writeup soon.  The answer here is entirely for context. If you don't agree, stop reading now :) On 2/15/2022 5:58 PM, Remi Forax

Re: [External] : Re: Reviewing feedback on patterns in switch

2022-02-16 Thread Brian Goetz
Not sure it's a no-brainer. The question is more a question of consistency. There are two consistencies and we have to choose one, either switch never allows null by default and users have to opt-in with case null or we want patterns to behave the same way if they are declared at top-level or