| Summary: | Init section of "for" blocks should be done at each iteration | ||
|---|---|---|---|
| Product: | [Modeling] Acceleo | Reporter: | Laurent Delaigue <laurent.delaigue> |
| Component: | Core | Assignee: | Project Inbox <acceleo-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | laurent.goubet |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows Vista | ||
| Whiteboard: | |||
init sections contain the definition of a set of variables that are meant to be used in the body of their owning block. For this purpose they are evaluated _before_ the block itself, and cannot use variables defined in said block (the "s" variable in your example). We do not plan on changing this behavior as the specification doesn't make it clear. |
Build Identifier: Currently in Acceleo, the initialization of variables declared in the init section of a "for" block is done once. It would make much more sense to perform the init block once for each iteration of the block (where the iterator variable could be used). And also, not to do this initialization at all if there is no iteration to be made! (iterating over an empty list I mean) Reproducible: Always Steps to Reproduce: [for (s : String | Sequence{}) { len : Integer = s.size();}] [len/] [/for]