[ATL] Are lazy rules 'evaluated' first than other rules? [message #14114] |
Wed, 31 January 2007 06:36  |
Eclipse User |
|
|
|
Originally posted by: jairson.gmail.com
Hi All,
I thought I would share with you the following experiment:
I have a helper like this:
helper context CHR!CHRProgram def : generateVars :
Sequence(CHR!VariableSymbol) = self.constantSymbols->collect(e |
thisModule.resolveTemp(e, 'vo'))->union(self.allRepeatedVars->collect(e
|thisModule.repeatedVariableSymbol2newVariableSymbol(e))).de bug('generateVars');
When I inspect the value 'generateVars' I always get the value from the
lazy rule already instantiated whereas the other rule gave me no value
at this point.
Is it then the case that lazy rules are evaluated earlier? If this is
true, are there any implications when trying to stick to the declarative
approach in ATL?
Thanks a lot,
Jairson Vitorino
|
|
|
Re: [ATL] Are lazy rules 'evaluated' first than other rules? [message #14132 is a reply to message #14114] |
Wed, 31 January 2007 06:20   |
Eclipse User |
|
|
|
Originally posted by: rchevrel.sodius.com
Hi Jairson,
The lazy rules are not evaluated earlier but when you ask them to be
evaluated.
But your helper look like false because you use collect on collection,
so you probably obtain collection of collections, not collection of
CHR!VariableSymbol.
Use "->flatten()" keyword to transform a collection of collections into
a collection. (e.g. {{a, b}, {c, d}}->flatten() = {a, b, c, d})
If your problem persist, please send all concerned parts of your ATL
file (notably your lazy rule, the rule witch matched the "e" element and
the helper call).
Best regards,
Régis CHEVREL
SODIUS
6, rue Cornouaille
44319 Nantes - France
Phone: +33 (0)2 28 23 54 34
www.mdworkbench.com
Draw more value from your model
Jairson a écrit :
> Hi All,
>
> I thought I would share with you the following experiment:
>
> I have a helper like this:
>
> helper context CHR!CHRProgram def : generateVars :
> Sequence(CHR!VariableSymbol) = self.constantSymbols->collect(e |
> thisModule.resolveTemp(e, 'vo'))->union(self.allRepeatedVars->collect(e
> |thisModule.repeatedVariableSymbol2newVariableSymbol(e))).de bug('generateVars');
>
>
> When I inspect the value 'generateVars' I always get the value from the
> lazy rule already instantiated whereas the other rule gave me no value
> at this point.
>
> Is it then the case that lazy rules are evaluated earlier? If this is
> true, are there any implications when trying to stick to the declarative
> approach in ATL?
>
>
> Thanks a lot,
>
> Jairson Vitorino
|
|
|
Re: [ATL] Are lazy rules 'evaluated' first than other rules? [message #14167 is a reply to message #14132] |
Wed, 31 January 2007 15:24  |
Eclipse User |
|
|
|
Originally posted by: jairson.gmail.com
Thank you Régis,
I used the debug tool and could find out what I was doing wrong.
regards,
Jairson Vitorino
Régis wrote:
> Hi Jairson,
>
> The lazy rules are not evaluated earlier but when you ask them to be
> evaluated.
>
> But your helper look like false because you use collect on collection,
> so you probably obtain collection of collections, not collection of
> CHR!VariableSymbol.
>
> Use "->flatten()" keyword to transform a collection of collections into
> a collection. (e.g. {{a, b}, {c, d}}->flatten() = {a, b, c, d})
>
> If your problem persist, please send all concerned parts of your ATL
> file (notably your lazy rule, the rule witch matched the "e" element and
> the helper call).
>
> Best regards,
>
>
> Régis CHEVREL
>
>
> SODIUS
> 6, rue Cornouaille
> 44319 Nantes - France
>
> Phone: +33 (0)2 28 23 54 34
>
> www.mdworkbench.com
> Draw more value from your model
>
>
>
>
> Jairson a écrit :
>> Hi All,
>>
>> I thought I would share with you the following experiment:
>>
>> I have a helper like this:
>>
>> helper context CHR!CHRProgram def : generateVars :
>> Sequence(CHR!VariableSymbol) = self.constantSymbols->collect(e |
>> thisModule.resolveTemp(e,
>> 'vo'))->union(self.allRepeatedVars->collect(e
>> |thisModule.repeatedVariableSymbol2newVariableSymbol(e))).de bug('generateVars');
>>
>>
>> When I inspect the value 'generateVars' I always get the value from
>> the lazy rule already instantiated whereas the other rule gave me no
>> value at this point.
>>
>> Is it then the case that lazy rules are evaluated earlier? If this is
>> true, are there any implications when trying to stick to the
>> declarative approach in ATL?
>>
>>
>> Thanks a lot,
>>
>> Jairson Vitorino
|
|
|
Powered by
FUDForum. Page generated in 0.02915 seconds