Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 347367 - [EOL] Allow per-resource global variables
Summary: [EOL] Allow per-resource global variables
Status: CLOSED FIXED
Alias: None
Product: Epsilon
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Antonio Garcia-Dominguez CLA
QA Contact:
URL:
Whiteboard: interim
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-26 16:15 EDT by Louis Rose CLA
Modified: 2012-11-08 16:40 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Louis Rose CLA 2011-05-26 16:15:48 EDT
Currently, EOL's  FrameStack provides a single frame for storing global variables. Increasingly, it seems as though some of the languages would benefit from a stack of frames for storing globals. In particular:

- EGL templates can call subtemplates, which might use different global variables. Currently EGL works around this limitation by shuffling global frames on and off EOL's FrameStack. See EglFrameStackManager and #347016 for more information.

- EUnit copies the variables created by @data operations into the global frame (see EUnitModule#applyDataBinding). In the future, it might be that the same data binding variables are not used for all tests, in which case a more general solution will be necessary.
Comment 1 Louis Rose CLA 2011-05-26 16:16:50 EDT
We have decided to target the first stable release after moving to EMFT for this fix.

There may be some unit tests that can be re-used in EglFrameStackMangerTests.
Comment 2 Louis Rose CLA 2011-05-26 16:17:33 EDT
In case we need a reminder of a possible solution, from Antonio's email:

If I have understood your code correctly, you shuffle snapshots of the
stack frame for global variables into a stack as you call the main
template and its subtemplates. I think we could fix this issue in a more
general fashion, just by changing the lookup logic a little in FrameStack.

The main problem now is that all variables available in a protected
stack frame must be either directly inside it or in the bottom stack
frame. I suggest that we allow for several unprotected stack frames at
the bottom of the stack, and start the global lookup from the topmost
unprotected stack frame.

We'd need to add an attribute referencing the topmost contiguous
unprotected stack frame in the FrameStack, and start global lookups from
there. Suppose we had this stack frame, from bottom to top:

1. unprotected stack frame with System and null
2. unprotected stack frame with out (main template) and x
3. unprotected stack frame with out (subtemplate) and y
4. protected stack frame from calling f()
5. protected stack frame from calling g()

The topmost unprotected stack frame is 3. f() can access x, y, System,
null and the copy of out which relates to the subtemplate. Same with
g(). Note that the copy of out relating to the main template is
"shadowed" here, as lookups start from 3.

This way, we only keep one stack, the usual stack frame. We'd need to
add a new attribute with the topmost unprotected stack frame, though.

This shouldn't affect most E*L languages, as they are fine with one
unprotected stack frame keeping all the global variables, but it would
benefit EGL and perhaps EUnit. Right now all tests go through all data
bindings, but they might not in the future.
Comment 3 Dimitris Kolovos CLA 2012-06-26 17:38:03 EDT
Have the recent changes to FrameStack and Frame perhaps addressed these issues?
Comment 4 Antonio Garcia-Dominguez CLA 2012-06-27 03:44:42 EDT
Louis and I already switched EGL to the new FrameStack implementation. EUnit doesn't use it yet, though: I'll adapt it now so we can close this bug.
Comment 5 Antonio Garcia-Dominguez CLA 2012-06-27 04:09:42 EDT
Done: EUnit also uses the new support for multiple global stack frames now (SVN r1908). I think we can mark this bug as fixed now :-).
Comment 6 Louis Rose CLA 2012-06-27 08:02:42 EDT
Thanks Antonio. I'm glad to see the back of this bug, although I did enjoy working together with you on this one!
Comment 7 Dimitris Kolovos CLA 2012-07-03 06:45:59 EDT
This has been fixed in the latest interim version.
Comment 8 Dimitris Kolovos CLA 2012-11-08 16:40:41 EST
Fixed in 1.0