Given a record R, and a record pattern R(P*), where P* is a list of nested patterns of the same arity as R's components, then

    x matches R(P*)

iff

    x instanceof R
    && R(var alpha*)  // always true, just binds
    && \forall i alpha_i matches P_i

If P* is empty, the last clause is vacuously true.

On 3/13/2022 11:09 AM, Remi Forax 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

Reply via email to