- *Refined type checking for GADTs. *Given a hierarchy like:
sealed interface Node { }
record IntNode(int i) implements Node { }
record FloatNode(float f) implements Node { }
we currently cannot type-check programs like:
Node twice(Node n) {
return switch (n) {
AM, Remi Forax wrote:
*From: *"Brian Goetz"
*To: *"amber-spec-experts"
*Sent: *Wednesday, May 18, 2022 9:18:01 PM
*Subject: *Pattern matching: next steps after JEP 405
JEP 405 has been proposed to target
*Cc: *"amber-spec-experts"
*Sent: *Thursday, May 19, 2022 3:05:07 PM
*Subject: *Re: Pattern matching: next steps after JEP 405
When you have a type pattern X in a middle of a pattern *and*
you have conversions, then there is an ambiguity,
does instanceof
> From: "Brian Goetz"
> To: "amber-spec-experts"
> Sent: Wednesday, May 18, 2022 9:18:01 PM
> Subject: Pattern matching: next steps after JEP 405
> JEP 405 has been proposed to target for 19. But, it has some loose ends that
> I'd
> like to refin
> From: "Brian Goetz"
> To: "Remi Forax"
> Cc: "amber-spec-experts"
> Sent: Thursday, May 19, 2022 3:05:07 PM
> Subject: Re: Pattern matching: next steps after JEP 405
>> When you have a type pattern X in a middle of a pattern *and* you have
When you have a type pattern X in a middle of a pattern *and* you have
conversions, then there is an ambiguity,
does instanceof Box(X x) means
Box(var v) && v instanceof X x
or
Box(var v) && X x = (X) v;
This is not an ambiguity in the language, it is confusion on the part of
the reade
> From: "Brian Goetz"
> To: "Remi Forax"
> Cc: "amber-spec-experts"
> Sent: Wednesday, May 18, 2022 11:08:41 PM
> Subject: Re: Pattern matching: next steps after JEP 405
>>> - Primitive patterns. This is driven by another existing asymme
Inference is also something we will need for pattern assignment
Box<>(var s) = box;
Yes, it would work the same in all pattern contexts -- instanceof as
well. Every pattern context has a match target whose static type is known.
- *Array patterns. * The semantics of array patte
> From: "Brian Goetz"
> To: "amber-spec-experts"
> Sent: Wednesday, May 18, 2022 9:18:01 PM
> Subject: Pattern matching: next steps after JEP 405
> JEP 405 has been proposed to target for 19. But, it has some loose ends that
> I'd
> like to refin
JEP 405 has been proposed to target for 19. But, it has some loose ends
that I'd like to refine before it eventually becomes a final feature.
These include:
- *Inference for record patterns. *Right now, we make you spell out
the type parameters for a generic record pattern, such as:
c
10 matches
Mail list logo