Community
Participate
Working Groups
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.
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.