Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Problem using `pre` to declare global data
Problem using `pre` to declare global data [message #629547] Tue, 28 September 2010 12:16 Go to next message
Andy Ed is currently offline Andy Ed
Messages: 41
Registered: December 2009
Member
I'm having a problem sharing data between rules/operation using the following style (using pre to declare 'globals').


pre{
var storedIniValues := new OrderedSet;
}

operation op1(){
var item := new m!elem;
storedIniValues .add(item);
}

Sometimes this approach does work, sometimes not; with my current problem I get an exception stating that Type storedIniValues is not found. Do you have any ideas why this approach works sometimes but not others?

cheers, Andy





Re: Problem using `pre` to declare global data [message #629578 is a reply to message #629547] Tue, 28 September 2010 14:32 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi Andy,

I've tried to reproduce this but to no avail. Could you perhaps put
together an example that reproduces this and send it to us at
epsilon.devs@gmail.com?

Cheers,
Dimitris

On 28/09/2010 17:16, Andy wrote:
> I'm having a problem sharing data between rules/operation using the
> following style (using pre to declare 'globals').
>
>
> pre{
> var storedIniValues := new OrderedSet;
> }
>
> operation op1(){
> var item := new m!elem;
> storedIniValues .add(item);
> }
>
> Sometimes this approach does work, sometimes not; with my current
> problem I get an exception stating that Type storedIniValues is not
> found. Do you have any ideas why this approach works sometimes but not
> others?
>
> cheers, Andy
>
>
>
>
>
>
Re: Problem using `pre` to declare global data [message #629668 is a reply to message #629578] Wed, 29 September 2010 04:14 Go to previous messageGo to next message
Andy Ed is currently offline Andy Ed
Messages: 41
Registered: December 2009
Member
The .etl file with the problem is imported by another .etl file. I put the var declaration in the parent's pre block and the problem disappeared. I would guess, therefore, that the problem could be something to do with importing and using a (nested) pre block. The pre block was not named in either case; when I named them them problem disappears so I think this is the cause.

cheers, Andy
Re: Problem using `pre` to declare global data [message #629697 is a reply to message #629668] Wed, 29 September 2010 05:53 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi Andy,

Many thanks for investigating! Pre/post blocks override imported blocks
with the same name (or no name) but I don't think this is mentioned in
the book. I'll add a comment about this in the book shortly.

Cheers,
Dimitris

On 29/09/2010 09:14, Andy wrote:
> The .etl file with the problem is imported by another .etl file. I put
> the var declaration in the parent's pre block and the problem
> disappeared. I would guess, therefore, that the problem could be
> something to do with importing and using a (nested) pre block. The pre
> block was not named in either case; when I named them them problem
> disappears so I think this is the cause.
>
> cheers, Andy
Re: Problem using `pre` to declare global data [message #629714 is a reply to message #629697] Wed, 29 September 2010 07:02 Go to previous message
Andy Ed is currently offline Andy Ed
Messages: 41
Registered: December 2009
Member
Hi Dimitris,

I did read, in the book, that pre blocks with the same names are overridden. But I simply didn't think about un-named blocks. Maybe some info could be presented to the user stating that un-named blocks are being overridden, just in case the user doesn't notice that more than one of the modules has an un-named pre block Embarrassed

cheers,
Andy
Previous Topic:ETL ANT Script help
Next Topic:EOL and feature maps
Goto Forum:
  


Current Time: Fri Jul 25 05:19:54 EDT 2014

Powered by FUDForum. Page generated in 0.01875 seconds