|
|
|
Re: Def expressions in OCLInEcore and the Interactive console. [message #1833554 is a reply to message #1833549] |
Fri, 16 October 2020 19:10 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
Bugs [1], [2], [3], [4] are relevant.
Operation result caching was added for QVT, where the system state is known to be stable, but as you observe that is not necessarily true for OCL enriched Ecore.
Helpers are difficult to support with the current narrow view of the Ecore API. Every non-trivial OCL operation has to discover where the OCL context is by searching for a ResourceSet adapter. Not very clever when an operation calls another operation using the API and so discarding the knowledge in the call. I have therefore been thinking of doubling the API, retaining the existing Ecore-API for OCL-blind call contexts but delegating to a new OCL-aware API that has an extra OCL argument. This should liberate the generated code from a tight-coupling to self/this allowing an OCLHelpers.java to be generated with static functions that can be invoked with the OCL-aware API. The OCL-aware API should successfully bypass many levels of eGet delegation.
Now that someone is interested, my 'thinking about' might reappear closer to the top of my to-do stack.
IIRC I added the support for QVT but then suppressed it pending some inspiration as to how to make it valid for OCL. It requires some ability to identify a suite of OCL operations that occur without a system state change. Could be achieved by a user application, such as QVT, but could also be used during model validation which does now have a workaround for the limitation that it is impossible for OCL validation to know when it starts or finishes unless the user is prepared to invoke start/stop operations or use a derived Diagnostician that does so. A pity that Diagnostician has no 'listener' capability.
(The delegate functionality that was added to EMF, primarily to support OCL is pretty magic. Unfortunately my review comments were ignored and so there are some aspects of the functionality that are needless klunky / restrictive.)
IIRC cached derived features work. You just need to declare an OCL-initialized, !volatile, derived feature to ensure that EMF allocates a field and invokes the setting delegate to initialize.
Regards
Ed Willink
[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=491264
[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=500519
[3] https://bugs.eclipse.org/bugs/show_bug.cgi?id=500520
[4] https://bugs.eclipse.org/bugs/show_bug.cgi?id=500521
|
|
|
Powered by
FUDForum. Page generated in 0.03355 seconds