Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 347016

Summary: [EGL] Operations should have access to out and dynamic sections
Product: [Modeling] Epsilon Reporter: Louis Rose <louis>
Component: CoreAssignee: Louis Rose <louis>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: dkolovos, louis
Version: unspecified   
Target Milestone: ---   
Hardware: Macintosh   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=313119
https://bugs.eclipse.org/bugs/show_bug.cgi?id=347367
https://bugs.eclipse.org/bugs/show_bug.cgi?id=347370
Whiteboard: interim

Description Louis Rose CLA 2011-05-24 12:11:31 EDT
Operations should be able to access the out variable. The following, for example, throws an exception right now:

[%  setup() %]
[% operation setup() {
	out.setContentType("XML");
} %]
Comment 1 Louis Rose CLA 2011-05-24 12:14:28 EDT
out is currently a local variable, it should be a global. However, making it a global would mean that subtemplates would access the same outputbuffer as their parent, and this is undesirable. Instead, we need a mechanism for indicating that a variable has global scope in the current template, and is inaccessible from subtemplates.

Chatting with Antonio, it seems he has a similar problem for data bindings in EUnit. We need to discuss this and see if there is a common solution.
Comment 2 Louis Rose CLA 2011-05-24 12:36:36 EDT
Fixing this will cause the error message added for #313119 to be redundant, and that logic should be removed.
Comment 3 Louis Rose CLA 2011-05-24 12:38:23 EDT
Fixing this will make it less clear when to annotate an operation with @template. The differences should be investigated:

Do we need to make @template and normal operations exactly the same? If so, do we need to deprecate @template?
Do we need to make @template and normal operation more different in some way?

Either way, we should also update the EGL documentation.
Comment 4 Louis Rose CLA 2011-05-26 16:27:20 EDT
(In reply to comment #1)
> out is currently a local variable, it should be a global. However, making it a
> global would mean that subtemplates would access the same outputbuffer as their
> parent, and this is undesirable. Instead, we need a mechanism for indicating
> that a variable has global scope in the current template, and is inaccessible
> from subtemplates.
> 
> Chatting with Antonio, it seems he has a similar problem for data bindings in
> EUnit. We need to discuss this and see if there is a common solution.

For now, I've fixed this by shuffling the global frame before and after executing a template. We've opened #347367 and will investigate a more general solution in the future.
Comment 5 Louis Rose CLA 2011-05-26 16:27:47 EDT
(In reply to comment #2)
> Fixing this will cause the error message added for #313119 to be redundant, and
> that logic should be removed.

I've removed this check as part of the fix.
Comment 6 Louis Rose CLA 2011-05-26 16:34:21 EDT
(In reply to comment #3)
> Fixing this will make it less clear when to annotate an operation with
> @template. The differences should be investigated:
> 
> Do we need to make @template and normal operations exactly the same? If so, do
> we need to deprecate @template?
> Do we need to make @template and normal operation more different in some way?
> 
> Either way, we should also update the EGL documentation.

I've opened #347370 to cover this investigation and update to the documentation.
Comment 7 Louis Rose CLA 2011-05-26 16:35:03 EDT
Fix checked into SVN. Assigning to Dimitris for build integration, thanks!
Comment 8 Louis Rose CLA 2011-06-01 14:26:02 EDT
This is fixed in SVN, and will appear in the next interim/stable builds.
Comment 9 Dimitris Kolovos CLA 2011-07-25 08:18:17 EDT
Fixed in 0.9.1