Question about imperative do blocks in ATL [message #1794106] |
Thu, 23 August 2018 11:26  |
Eclipse User |
|
|
|
I am performing a study to understand how the different ATL features are used in the ATL Zoo (http://www.eclipse.org/atl/atlTransformations/).
I noticed in many transformations in the ATL zoo, an imperative do block would contain only a variable name followed by a semi colon (where this variable could be a target pattern element).
For example:
"rule Category(name : String, desc : String) {
to
cat : Measure!Category (
name <- name,
desc <- desc
)
do { cat; }}".
I cannot seem to find in the ATL documentation what would be the effect of such a command ? Is this only for debugging purposes (i.e., to show the value of the variable"cat" in the above example in the console) ? or would this result in returning the value of "cat" as the return value of the rule ?
Thanks a lot in advance...
|
|
|
|
|
Re: Question about imperative do blocks in ATL [message #1794309 is a reply to message #1794197] |
Tue, 28 August 2018 14:01   |
Eclipse User |
|
|
|
Just to follow up on my previous question, I found a transformation with the following called rule:
rule MeasureSet2ValueRow(ms : Measure!MeasureSet) {
to
retval : Table!Row (
cells <- blabla,
cells <- blabla)
do {
retval; }
}
Then, in the same transformation, another called rule invoked the above called rule as follows:
rows <- allMeasSet->
collect(ms|thisModule.MeasureSet2ValueRow(ms))
Thus, in the latter rule invocation, the return value of the called rule was not assigned to a specific value (they were only accumulated using the collect operation, but without assigning the return value to variables).
My question is, since the return value of MeasureSet2ValueRow in the invocation wasn't assigned to a variable, would this rule invocation have still worked if the rule MeasureSet2ValueRow didnot have a do block? If not, why not ? If yes, then what''s the need for "retval;" in the do block of the rule MeasureSet2ValueRow ?
Thanks a lot !
|
|
|
Re: Question about imperative do blocks in ATL [message #1794310 is a reply to message #1794197] |
Tue, 28 August 2018 14:02   |
Eclipse User |
|
|
|
Just to follow up on my previous question, I found a transformation with the following called rule:
rule MeasureSet2ValueRow(ms : Measure!MeasureSet) {
to
retval : Table!Row (
cells <- blabla,
cells <- blabla)
do {
retval; }
}
Then, in the same transformation, another called rule invoked the above called rule as follows:
rows <- allMeasSet->
collect(ms|thisModule.MeasureSet2ValueRow(ms))
Thus, in the latter rule invocation, the return value of the called rule was not assigned to a specific value (they were only accumulated using the collect operation, but without assigning the return value to variables).
My question is, since the return value of MeasureSet2ValueRow in the invocation wasn't assigned to a variable, would this rule invocation have still worked if the rule MeasureSet2ValueRow didnot have a do block? If not, why not ? If yes, then what''s the need for "retval;" in the do block of the rule MeasureSet2ValueRow ?
Thanks a lot !
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07856 seconds