Matched rule without a "to" section [message #91251] |
Fri, 03 October 2008 16:47 |
Eclipse User |
|
|
|
Originally posted by: matteo.risoldi.unige.ch
Hello,
I noticed in my transformations that, at least using the atl2006
compiler, it seems acceptable to have a matched rule (not called)
without a "to" section, but only with "from" and "do", like the
following:
rule initCFC {
from
cfc : COOPNModel!COOPNPackage,
spec : cospel!Specification
do{
thisModule.CFCMODEL <-cfc;
thisModule.ruleSpecification(spec);
}
}
This works perfectly in my project. Is this foreseen behaviour? I ask
because it doesn't match the grammar shown in the ATL manual, where the
"to" section is not marked as optional.
I would like to know if I should use this pattern, or if I should
expect a bug fix in subsequent atl versions which would kill my
transformations written this way...
Thanks for the information.
Best regards
Matteo
|
|
|
Re: Matched rule without a "to" section [message #91513 is a reply to message #91251] |
Tue, 07 October 2008 08:50 |
Tristan Faure Messages: 460 Registered: July 2009 |
Senior Member |
|
|
Matteo,
I think you can do that without problems; I used it for the past
but ATL doesn't recommend the usage of "to" sections so be careful when
you do this.
For example you never know when the rules are matched and when the to
section is performed (generally at the end) so at a specific moment you
will want to use your var CFCModel but the var will be set once and the
second time won't be
Matteo Risoldi a écrit :
> Hello,
>
> I noticed in my transformations that, at least using the atl2006
> compiler, it seems acceptable to have a matched rule (not called)
> without a "to" section, but only with "from" and "do", like the following:
>
> rule initCFC {
> from
> cfc : COOPNModel!COOPNPackage,
> spec : cospel!Specification
> do{
> thisModule.CFCMODEL <-cfc;
> thisModule.ruleSpecification(spec);
> }
> }
>
> This works perfectly in my project. Is this foreseen behaviour? I ask
> because it doesn't match the grammar shown in the ATL manual, where the
> "to" section is not marked as optional.
> I would like to know if I should use this pattern, or if I should expect
> a bug fix in subsequent atl versions which would kill my transformations
> written this way...
>
> Thanks for the information.
> Best regards
> Matteo
>
|
|
|
Powered by
FUDForum. Page generated in 0.02866 seconds