Hi all,
The syntax rule and static semantics of matchop were defined as:
MatchOp ::= MatchKeyword "(" Expression "," TemplateInstance")"
/* STATIC SEMANTICS - The type of the value returned by the expression
must be the same as the template type and each field of the template shall
resolve to a single value */
however, the Expression can resolve to a CompoundExpression, whose type,
in my view, may be ambiguous, for example,
match({f1 := 1, f2 := true}, template1);
The type of value returned by the expression may be a record type,
type record MyRecord
{
integer f1,
boolean f2
}
or a set type,
type set MySet
{
integer f1,
boolean f2
}
I think that defining the rule as "MatchOp ::= MatchKeyword
"("SingleExpression, "," TemplateInstance")" " may be more resonable.
By the way, anybody can explain the meanings of "resolve to a single
value" in STATIC SEMANTICS ? thanks.
Any comments would be appreciated.
Best Regards,
Ji XiangDong