- Original Message -
> From: "Tagir Valeev"
> To: "Brian Goetz"
> Cc: "amber-spec-experts"
> Sent: Wednesday, January 26, 2022 5:20:24 AM
> Subject: Re: Treatment of total patterns (was: Reviewing feedback on patterns
> in switch)
>> Null is only matched by a switch case that includes
> Null is only matched by a switch case that includes `case null`. Switches
> with no `case null` are treated as if they have a `case null: throw NPE`.
> This means that `case Object o` doesn’t match null; only `case null, Object
> o` does.
> Total patterns are re-allowed in instanceof express
Hello!
For the record: I like the current version with &&. It's short and
easy to understand (as people already know what && means in Java). I
see no reason in replacing it with `when`, which is more limiting.
> because of the potential confusion should we ever choose to support switch
> over bo
> From: "Brian Goetz"
> To: "amber-spec-experts"
> Sent: Tuesday, January 25, 2022 8:47:09 PM
> Subject: Treatment of total patterns (was: Reviewing feedback on patterns in
> switch)
>> 1. Treatment of total patterns in switch / instanceof
> The handling of totality has been a long and painful
- Original Message -
> From: "Brian Goetz"
> To: "amber-spec-experts"
> Sent: Tuesday, January 25, 2022 8:49:02 PM
> Subject: Positioning of guards (was: Reviewing feedback on patterns in switch)
>> 2. Positioning of guards
>
> We received several forms of feedback over the form and pl
- Original Message -
> From: "Brian Goetz"
> To: "amber-spec-experts"
> Sent: Tuesday, January 25, 2022 8:49:08 PM
> Subject: Patterns and GADTs (was: Reviewing feedback on patterns in switch)
>> 3. Type refinements for GADTs
>
> There are a number of unsatisfying aspects to how we cur
- Original Message -
> From: "Brian Goetz"
> To: "amber-spec-experts"
> Sent: Tuesday, January 25, 2022 8:49:12 PM
> Subject: Diamond in type patterns (was: Reviewing feedback on patterns in
> switch)
>> 4. Diamond for type patterns (and record patterns)
>
>
> The type pattern `T t`
> 4. Diamond for type patterns (and record patterns)
The type pattern `T t` declares `t`, if the pattern matches, with the type T.
If T is a generic type, then we do a consistency check to ensure soundness:
List list = …
switch (list) {
case ArrayList a: A // ok
case
> 3. Type refinements for GADTs
There are a number of unsatisfying aspects to how we currently handle GADTs;
specifically, we are missing the type refinement process outlined in "Simple
unification-based type inference for GADTs” (SPJ et al, 2005). Here are some
examples of where we fall down
> 2. Positioning of guards
We received several forms of feedback over the form and placement of guarded
patterns. Recall that we define a guarded pattern to be `P && g`, where P is a
pattern and g is a boolean expression. Guarded patterns are never total. Note
that we had a choice of the gu
1. Treatment of total patterns in switch / instanceof
The handling of totality has been a long and painful discussion, trying to
balance between where we want this feature to land in the long term, and
people’s existing mental models of what switch and instanceof are supposed to
do. Because
We’ve previewed patterns in switch for two rounds, and have received some
feedback. Overall, things work quite well, but there were a few items which
received some nontrivial feedback, and I’m prepared to suggest some changes
based on them. I’ll summarize them here and create a new thread for
12 matches
Mail list logo