Array patterns (and varargs patterns)
Gavin Bierman
gavin.bierman at oracle.com
Wed Jan 6 10:01:35 UTC 2021
This is a feature that other languages call an “as pattern”, because you are adding a new pattern variable binding to another pattern (Standard ML used “as”, Haskell uses “@“ but calls it an as pattern). It’s on our list of things to consider; part of the consideration is whether it merits special syntax along with the parsing issues of not having special syntax.
Gavin
> On 6 Jan 2021, at 05:44, Suminda Sirinath Salpitikorala Dharmasena <sirinath1978m at gmail.com> wrote:
>
> Can we have something like:
>
> if (arr instanceof String[] { var a, var b, ... } stringArray) {
> ... }
>
> `stringArray` is optional but if present this will referrer to the whole
> array.
>
>>
More information about the amber-dev
mailing list