| Summary: | [EGL] Is @template now redundant? | ||
|---|---|---|---|
| Product: | [Modeling] Epsilon | Reporter: | Louis Rose <louis> |
| Component: | Core | Assignee: | Louis Rose <louis> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: | https://bugs.eclipse.org/bugs/show_bug.cgi?id=347016 | ||
| Whiteboard: | |||
|
Description
Louis Rose
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)
[% } %]
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. |