|Re: Possible bug in generated code [message #1697197 is a reply to message #1697166]
||Tue, 02 June 2015 11:29
| Ed Willink
Registered: July 2009
On 02/06/2015 08:14, Wilbert Alberts wrote:
> Oh, and thanks for the .concat remark. I used the construct already
> for a long time in Acceleo but never thought of using it in the ecore
> ocl editor too. I thought it was an Acceleo extension.
It was also a QVTo extension and such an obvious one that it got
promoted in, IIRC, OCL 2.3.
> I think that I don't get the reason about using 'initial' vs
> 'derived'. If I make it 'initial', then what happens if I change the
> value of 'element'. Will the value of 'id' be updated?
> Is the (actual) semantics of them somewhere described? (I do own the
> EMF book but that might not be that accurate (anymore)).
This is nothing to do with EMF, so don't look for guidance there.
In the Eclipse OCL code there was for a long time the problem; what is
the difference between initial and derived and if both are specified
which is used when? In the absence of clarity either could be used
interchangeably and if you specify both differently read the code to
discover what happens.
The OCL specification clause on OCL within UML is very weak, but it does
consistently refer to initial value expressions and derived value
constraints. Therefore an initial value expression is a query that
computes an initial value for readonly properties, or a prevailing
(derived) value for not-readonly properties. A derived value constraint,
is just another class invariant that must always be satisfied. It
differs from a class invariant solely through a relationship to a
Property; diagnostics can therefore refer more precisely to an
unsatisfactory Property rather than an unsatisfactory Class.
The above is my resolution of the vagueness. It is not yet accurately
reflected in the Pivot OCL code. There are at least a couple of related
outstanding bugs. When I tried to change your example to "initial", a
couple of GenModel synchronization issues distracted me.
Powered by FUDForum
. Page generated in 0.02298 seconds