Bug 507658 - [pivot] Introduce LetVariable, IteratorVariable, ResultVariable
Summary: [pivot] Introduce LetVariable, IteratorVariable, ResultVariable
Status: RESOLVED FIXED
Alias: None
Product: OCL
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: M4   Edit
Assignee: OCL Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 507628 509309 507619
  Show dependency tree
 
Reported: 2016-11-17 04:26 EST by Ed Willink CLA
Modified: 2017-05-16 08:32 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2016-11-17 04:26:43 EST
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.
Comment 1 Ed Willink CLA 2016-11-18 09:21:26 EST
(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.
Comment 2 Ed Willink CLA 2016-11-18 09:21:42 EST
Resolved too.