Pattern Matching for instanceof (Preview 2)
forax at univ-mlv.fr
forax at univ-mlv.fr
Thu Feb 6 22:21:36 UTC 2020
----- Mail original -----
> De: "Brian Goetz" <brian.goetz at oracle.com>
> À: "Remi Forax" <forax at univ-mlv.fr>, "jan lahoda" <jan.lahoda at oracle.com>
> Cc: "amber-spec-experts" <amber-spec-experts at 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
More information about the amber-spec-observers
mailing list