|[Acceleo3] for loop over collection [message #656973]
||Tue, 01 March 2011 08:44
| Wilbert Alberts
Registered: June 2010
According to the MOF Model to Text Transformation
Language, v1.0 standard, I should be able to avoid writing a for loop by invoking a template on a collection.
So assume I defined:
[template genFoo(p: Foo)]
and suppose that 's' represents a collection of Foo. Then,
should result in invocation of genFoo for each element of 's' if I'm right.
It seems to me that this is not (yet) implemented in Acceleo or am I doing something wrong?
PS: from the standard:
A template invocation specifies one or more invocations of a template. An argument of a template invocation is specified
by an expression that could evaluate either to a single value or a set of values. The rules for determining which template
to invoke and how many times are as follows:
- The types of arguments should match the types of the corresponding parameters. An argument type matches the parameter type when the latter is either the same type or a super type. If the argument is a set and the parameter is a singleton, then the template is invoked for each member of the set.
Powered by FUDForum
. Page generated in 0.03145 seconds