Re: Simplifying switch labels

2022-06-02 Thread Dan Smith
> On Jun 2, 2022, at 2:59 PM, Brian Goetz wrote: > > >> Oh, I guess I missed your point here, thinking that P and Q were constants. >> >> Your comment implies that the two rules that restrict usage of >> patterns—can't fall through past one, and can't combine one (via ',') with >> most other

Re: Simplifying switch labels

2022-06-02 Thread Brian Goetz
Oh, I guess I missed your point here, thinking that P and Q were constants. Your comment implies that the two rules that restrict usage of patterns—can't fall through past one, and can't combine one (via ',') with most other labels—could be relaxed slightly in the case of patterns that hav

Re: Simplifying switch labels

2022-06-02 Thread Dan Smith
On Jun 2, 2022, at 2:22 PM, Dan Smith mailto:daniel.sm...@oracle.com>> wrote: Ideally, the fallthrough rule should be about _bindings_, not _patterns_. If P an Q are patterns with no binding variables, then it should be OK to say: case P: case Q: The rule about fallthrough is to prevent fallin

Re: Simplifying switch labels

2022-06-02 Thread Dan Smith
> On Jun 2, 2022, at 12:08 PM, Brian Goetz wrote: > >> In this framing, the restrictions about sets of elements in a single label >> don't apply, because we're talking about two different labels. But we have >> rules to prevent various abuses. Examples: >> >> case 23: case Pattern: // illegal

Re: Simplifying switch labels

2022-06-02 Thread Remi Forax
- Original Message - > From: "Brian Goetz" > To: "daniel smith" , "amber-spec-experts" > > Sent: Thursday, June 2, 2022 8:08:14 PM > Subject: Re: Simplifying switch labels >> In this framing, the restrictions about sets of elements in a single label >> don't >> apply, because we're tal

Re: Simplifying switch labels

2022-06-02 Thread Brian Goetz
In this framing, the restrictions about sets of elements in a single label don't apply, because we're talking about two different labels. But we have rules to prevent various abuses. Examples: case 23: case Pattern: // illegal before and now, due to fallthrough Pattern rule Ideally, the