Home » Modeling » Epsilon » No pre/post conditions in ETL?
No pre/post conditions in ETL? [message #900209] |
Sun, 05 August 2012 11:23  |
Eclipse User |
|
|
|
Hej!
As I understand the Epsilon book, all the features of EOL should be
available in all its offspring languages, e.g. ETL. Is this correct so far?
I have a transformation which implements a simple mapping. I'm including
the sample add function from the Epsilon book, listing
3.7, annotated with a pre condition. The transformation does actually
never call the add function.
Already when typing, $pre gives me an Eclipse error marker in editor:
Multiple markers at this line
- required (...)+ loop did not match anything at input '$'
- mismatched input '>' expecting '{'
Running the transformation yields (reformatted for readability):
[epsilon.etl - minimalRevolution.etl] Line: whatever, Reason:
required (...)+ loop did not match anything at input '$'
required (...)+ loop did not match anything at input '$'
mismatched input '>' expecting '{'
The actual transformation is not run. Similar issue for post conditions.
Is this an error and I should open a bug report? Or did I miss something
and it's should not be expected to work (or in a different way)?
Thanks & best regards,
Fabian
|
|
| |
Re: No pre/post conditions in ETL? [message #900354 is a reply to message #900326] |
Mon, 06 August 2012 11:24   |
Eclipse User |
|
|
|
Hi Horacio,
Yes, that's pretty much it. I'd like to point out a few things, though: the $pre/$post annotations and the pre/post blocks have quite different semantics.
$pre/$post annotations are for Boolean preconditions and postconditions, and will produce errors if they are violated. They are only available in .eol and .egl scripts, as I have gathered from a quick look at the source code.
However, pre/post blocks are simply EOL blocks that will be run before and after anything in the global scope of the script. These should work for ETL, ECL, EML, EPL and EVL scripts. EOL scripts don't need them. Other languages may allow them in their grammars, but I believe they don't really run those blocks.
Regards,
Antonio
|
|
| | |
Re: No pre/post conditions in ETL? [message #902245 is a reply to message #901857] |
Thu, 16 August 2012 10:02   |
Eclipse User |
|
|
|
Hi Horacio, hi Fabian,
fabtagon . wrote on Tue, 14 August 2012 15:09
That's the use I've been looking for in ETL, but just to get a grasp on
Epsilon, I don't actually need them (though they might become handy in
the future).
It's a feature of EOL, which only EGL inherits, as it's the only language that also allows for user-defined operations. If you look at the others, they don't really allow for new operations: they define rules (Flock, ETL, ECL, EML, EPL) or invariants (EVL), which don't really work the same way.
fabtagon . wrote on Tue, 14 August 2012 15:09
Maybe first sentence introducing the pre/post condition in subsection
3.2.2 of the Epsilon book could be changed from
"A number of the pre and post executable annotations can be attached to
EOL operations to specifiy the pre- and post-conditions of the operation."
to
"A number of the pre and post executable annotations can be attached to
EOL (as well as EGL) operations to specifiy the pre- and post-conditions
of the operation."
to save other users from the same wrong expectation.
Thanks for the suggestion . However, perhaps it may be too soon in the book to mention EGL (which is described in a later chapter). In any case, I've updated the book so it specifically mentions that EGL operations also support $pre/$post/@cached and that the pre/post blocks in the other languages should not be confused with the $pre/$post annotations. Would that be enough?
To keep things simple, the book doesn't mention ERL, which is the superset of EOL that ETL, EVL, EML, ECL and EPL are based on and that defines the infamous pre/post blocks . It's not big enough to merit its own chapter, though.
fabtagon . wrote on Tue, 14 August 2012 15:09
Thanks again for your answers!
You're both welcome!
Antonio
|
|
| |
Re: No pre/post conditions in ETL? [message #902919 is a reply to message #901857] |
Tue, 21 August 2012 03:43  |
Eclipse User |
|
|
|
Fabian,
In ETL, an the other languages that support the pre/post block, you can get the boolean precondition/postcondition to work if you use the "throw()" operation. At least I remember a post of the forums talking about it. I think it works similar to a throw exception in java. So you can test for conditions in your pre/post blocks and throw an exception that will interrupt the ExL execution and give you a sound message of what went wrong.
Personally I believe that it would be better to create EVL rules to validate your input model(s) so that you can guarantee that the ExL rules will generate 'correct' output model(s).
Antonio,
Thanks for adding this information into the book.
Regards,
|
|
|
Goto Forum:
Current Time: Wed Jul 23 11:58:57 EDT 2025
Powered by FUDForum. Page generated in 0.09588 seconds
|