----- Mail original ----- > De: "Brian Goetz" <brian.go...@oracle.com> > À: "Remi Forax" <fo...@univ-mlv.fr>, "jan lahoda" <jan.lah...@oracle.com> > Cc: "amber-spec-experts" <amber-spec-experts@openjdk.java.net> > Envoyé: Jeudi 6 Février 2020 23:04:05 > Objet: Re: Pattern Matching for instanceof (Preview 2)
>> I see two questions: >> - the grammar allows to mix var and non-var for a given reference type, i >> think >> that should only permitted if the non var is a deconstruction itself ? > > More generally, any pattern can appear nested inside a deconstruction > pattern -- another deconstruction pattern, a var (any) pattern, a type > pattern, a constant pattern ... we may not have them all right now, but > any pattern will do. var is not really any, it's an inferred type pattern. '_' is any, no ? > >> - must the identifier of a pattern argument be the same name as the >> corresponding record component ? >> To be coherent with the fact that constructors requires the same names. > > Nope! This is the use site; the client can name their locals however > they like. Invocation of deconstructors, like constructors, is positional. Ok, make sense. Rémi