Pattern Matching for instanceof (Preview 2)
gavin.bierman at oracle.com
Tue Feb 18 15:16:40 UTC 2020
> On 18 Feb 2020, at 15:04, forax at univ-mlv.fr wrote:
> Hi Gavin,
> ----- Mail original -----
>> De: "Gavin Bierman" <gavin.bierman at oracle.com>
>> À: "Remi Forax" <forax at univ-mlv.fr>
>> Cc: "jan lahoda" <jan.lahoda at oracle.com>, "amber-spec-experts" <amber-spec-experts at openjdk.java.net>
>> Envoyé: Mardi 18 Février 2020 15:32:12
>> Objet: Re: Pattern Matching for instanceof (Preview 2)
>> [Just circling back to this, as I added a note about the grammar to the JEP
>>> On 6 Feb 2020, at 20:38, Remi Forax <forax at univ-mlv.fr> wrote:
>>> [moved to amber-spec]
>>> ----- Mail original -----
>>>> De: "jan lahoda" <jan.lahoda at oracle.com>
>>>> À: "amber-dev" <amber-dev at openjdk.java.net>
>>>> Envoyé: Jeudi 6 Février 2020 21:18:52
>>>> Objet: Pattern Matching for instanceof (Preview 2)
>>>> Thanks to Gavin, Brian and Alex, there is a new draft JEP for Pattern
>>>> Matching for instanceof (Preview 2):
>>>> Any feedback on the JEP is more than welcome!
>>> so the difference with the previous preview is that deconstruction is added.
>> That is correct.
>>> 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 ?
>> I don’t know what you mean here. There are two patterns, a type test pattern and
>> a deconstruction pattern. In v2 we propose to support deconstruction patterns
>> over record types *only*. A deconstruction pattern looks like this: Point(var
>> a, var b), i.e. all the components are either (recursively) deconstruction
>> patterns, or `var` <identifier>, i.e. with no type needed. I added a note to
>> the JEP page pointing out that this is a starting point, and eventually we will
>> support other patterns in the argument position, specifically <type>
>> <identifier>; hopefully in this release.
> Currently we don't support mixing var and non var in lambda parameters.
> So my question is: does this pattern Point(var x, int y) that mix a 'var' and an explicit type allowed or not ?
Aha. So, we’re not at that stage yet - this isn’t allowed by the spec as it stands. This - and many other issues - is why I’m starting small…
Do you have a preference?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the amber-spec-experts