Record pattern: matching an empty record
Gavin Bierman
gavin.bierman at oracle.com
Fri Mar 25 11:37:24 UTC 2022
That’s right; with record patterns pattern matching can now initialise **zero or more** pattern variables (with type patterns it was always exactly one pattern variable to initialise).
Gavin
> On 13 Mar 2022, at 15:09, Remi Forax <forax at univ-mlv.fr> wrote:
>
> Hi all,
> while writing the prototype of the runtime,
> i found a case i think we never discuss, can we match an empty record ?
>
> record Empty() { }
>
> switch(object) {
> case Empty() -> ... // no binding here
>
> I think the answer is yes because i don't see why we should do a special case for that, but i may be wrong.
>
> Rémi
More information about the amber-spec-experts
mailing list