Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 347370 - [EGL] Is @template now redundant?
Summary: [EGL] Is @template now redundant?
Status: CLOSED FIXED
Alias: None
Product: Epsilon
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Louis Rose CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-26 16:32 EDT by Louis Rose CLA
Modified: 2012-02-06 10:59 EST (History)
0 users

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:32:34 EDT
Given that operations now have access to the out variable (see 347016) and hence can use dynamic output sections, it's not clear whether we need the @template operation as well.

Either way, we need to update the Epsilon documentation as there is a less obvious distinction between annotated and unannotated operations now.
Comment 1 Louis Rose CLA 2011-07-14 10:54:35 EDT
Thinking about this, "standard" (unannotated) operations and @template operations are indeed different, and both seem to have their own use cases. I will update the book to reflect this, and will include the example below.

Consider the following code. @template operations return a string that can be postprocessed before being emitted (e.g. the call to firstToLowerCase below). Standard operations, by contrast, return no useful value and instead emit text as soon as they generate it.

[* The following returns no value, and immediately outputs "1" *]
[% "Foo".unannotated(); %]
[* The following returns a String, and hence permits postprocessing *]
[%="Foo".annotated()%]
[%="Foo".annotated().firstToLowerCase()%]

[% operation Any unannotated() {%]
[%=self%] (from standard operation)
[% } %]
[% @template
operation Any annotated() {%]
[%=self%] (from template operation)
[% } %]
Comment 2 Louis Rose CLA 2011-07-19 04:25:49 EDT
This bug now relates only to the Epsilon Book.

I've added a section on "user-defined operations in EGL" to the Epsilon Book, and committed it to SVN.