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

Angelos Bimpoudis angelos.bimpoudis at oracle.com
Thu Apr 14 21:34:13 UTC 2022


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> on behalf of Gavin Bierman <gavin.bierman at oracle.com>
Sent: 07 April 2022 13:40
To: amber-spec-experts <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


More information about the amber-spec-observers mailing list