Draft Spec for Third Preview of Pattern Matching for Switch and Record Patterns (JEP 405) now available

Gavin Bierman gavin.bierman at oracle.com
Wed Apr 20 15:51:20 UTC 2022


Thanks Aggelos, all corrected .

Gavin

On 14 Apr 2022, at 22:34, Angelos Bimpoudis <angelos.bimpoudis at oracle.com<mailto:angelos.bimpoudis at oracle.com>> wrote:

Hello Gavin,

Exceptional work. Some minor proposals from my side...

14.11.1 includes a discussion about executable switch expressions and statements. It describes the transformation of default and case labels after resolution of patterns. Maybe this deserves a separate subsection.

> A set of case elements is exhaustive for a type T if it contains a pattern that is unconditional at type T (14.30.3)

I think this is a crucial rule since it brings the two worlds of totality and exhaustivity together. It deserves a tiny example here. Do you think it would be beneficial?

> The set Q is exhaustive from component d at type V, where d is the component following c, V is the type of corresponding component field in T, and Q is the set of patterns containing every record pattern in P whose component pattern corresponding to c covers U.

Instead of using the word "covers" we need to talk about the T <: U subtype relation. Covers is a remnant of the previous terminology set IIUC (which was good, but here is undefined).

nitpicking:

a instanceof expression -> an
a enum -> an enum
a unrefined -> an unrefined
and that statement can completely normally -> can complete normally
then it is further tranformed -> then it is further *transformed*
or the RelationalExpression of a instanceof -> an

Many thanks,
Aggelos

________________________________
From: amber-spec-experts <amber-spec-experts-retn at openjdk.java.net<mailto:amber-spec-experts-retn at openjdk.java.net>> on behalf of Gavin Bierman <gavin.bierman at oracle.com<mailto:gavin.bierman at oracle.com>>
Sent: 07 April 2022 13:40
To: amber-spec-experts <amber-spec-experts at openjdk.java.net<mailto:amber-spec-experts at openjdk.java.net>>
Subject: Draft Spec for Third Preview of Pattern Matching for Switch and Record Patterns (JEP 405) now available

Dear experts:

The first draft of a spec covering both the third preview of Pattern Matching for switch (JEP number coming, but currently available at https://openjdk.java.net/jeps/8282272) and JEP 405 (Record Patterns) is now available at:

http://cr.openjdk.java.net/~gbierman/PatternSwitchPlusRecordPatterns/PatternSwitchPlusRecordPatterns-20220407/specs/patterns-switch-jls.html

Comments welcome!

Thanks,
Gavin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20220420/bd6fba5e/attachment-0001.htm>


More information about the amber-spec-experts mailing list