Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: MatchOp

MatchOp 25 Jul 2003 03:57 #6504

  • Xdji
  • Xdji's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 10
  • Karma: 0
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
The administrator has disabled public write access.
  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin