Question about constraints vs. invariants [message #687031] |
Mon, 23 May 2011 15:55  |
Eclipse User |
|
|
|
Originally posted by:
Hi,
The EMF delegates mechanism provides two ways of validating the
EObjects, constraints and invariants. AFAIU, invariants are meant to be
small and quick checks that can happen often while constraints are meant
to implement more global checks. What I don't understand is how this has
lead to the particular implementation of these. In particular, invariant
are implemented using modelled EOperation with a specific signature. Why
has this particular implementation been chosen and how can the arguments
of the EOperation be used in the body?
Regards,
Hallvard
|
|
|
|
|
Re: Question about constraints vs. invariants [message #687034 is a reply to message #687033] |
Tue, 24 May 2011 01:12  |
Eclipse User |
|
|
|
Hi
>> The arguments can only be used from Java bodies.
>
> What can the arguments be used for in that case? Provide better
> messages? I'm implementing support for Javascript-based delegates
> (similar to the OCL support), so I wonder if there are special use
> cases I should support.
>
As I wrote that I considered adding a magic 'oclContextTuple' to access
the context from OCL, but very low priority and certainly not at RC2.
The 'DiagnosticChain diagnostics' argument is needed if you take control
since it is the diagnostic output 'stream'. If you have a conventional
control flow then it is used automatically.
The 'Map<Object, Object> context' argument allows arbitrary objects and
values to be passed in, and in some cases updated. A common use is
provision of a SubstitutionLabelProvider to pretty print the
descriptions of interesting objects in diagnostics.
Regards
Ed Willink
|
|
|
Powered by
FUDForum. Page generated in 0.05498 seconds