Home » Modeling » Epsilon » No pre/post conditions in ETL?
|
Re: No pre/post conditions in ETL? [message #900326 is a reply to message #900209] |
Mon, 06 August 2012 13:46 |
|
Hello Fabian,
If you look at section 5.4 in the Epsilon book you will find that in ETL pre and post conditions blocks have a different syntax:
(pre|post) <name> {
statement+
}
I think the $pre/post syntax only works for EOL operations and in the rest of languages the ETL style applies.
Please let us know if this works for you.
Regards,
Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
|
|
|
Re: No pre/post conditions in ETL? [message #900354 is a reply to message #900326] |
Mon, 06 August 2012 15:24 |
|
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 14:02 |
|
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 07:43 |
|
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,
Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
|
|
|
Goto Forum:
Current Time: Fri Mar 29 13:21:55 GMT 2024
Powered by FUDForum. Page generated in 0.05715 seconds
|