Community
Participate
Working Groups
OMG OCL defines Variable and a derived Parameter, and makes extensive use of an undefined VariableDeclaration. The Pivot OCL cleaned up a bit by defining VariableDeclaration as the abstract concept of a variable referenced by e.g. a VariableExp. Variable and Parameter are derived classes. QVT unnecessarily (structurally) introduces FunctionParameter as a joint derivation of Variable and Parameter. QVT reuses Variable for pattern variables. OCL has let, loop iterator, iterate result variables, each with significantly different initialization semantics. Once WFR's are defined for Variable, the semantic overload of Variable becomes embarrassing. QVTd has to disable the validation that an initializer type conforms to the variable's type, since a reverse conformance is a plausible predicate. Strong OCL WFRs fail. A let variables multiplicity should replicate its initializer. A result variable may be initialized with a [1] multiplicity, but there is no reason why null should not be assigned later. ---- Distinct WFRs can be achieved by: Moving the Variable WFRs to the variable's container. Opaque. Providing distinct container-sensitive guards for multiple Variable WFRs. Not fully extensible. Providing polymorphic helper functions so that the WFR is dispatched to derived classes. Semantically questionable. Introduce new classes, LetVariable, IteratorVariable, ResultVariable (GuardVariable, BottomVariable) for each distinct semantic. ---- For Pivot 1.x API compatibility, the new classes should all derive from Variable. The WFRs are on the new classes. For Pivot 2.x Variable can be folded into VariableDeclaration perhaps using Variable as the folded name.
(In reply to Ed Willink from comment #0) > Introduce new classes, LetVariable, IteratorVariable, ResultVariable and OCL: ParameterVariable > (GuardVariable, BottomVariable) for each distinct semantic. See Bug 507702. > ---- New per-derived Variable class WFRs avoid semantic confision, even if maintaining API compatibility is a bit of a compromise. See Bug 507628. Pushed to master for M4.
Resolved too.