Arjan,
see comments inlined.
Arjan Kok a écrit :
Hi Laurent,
See intermixed.
2008/8/18 Laurent Goubet <laurent.goubet@xxxxxxx>:
Hi Arjan,
I have trouble understanding the expected way to handle InitSections
throughout MTL. The spec defines an "initSection" reference on the meta-type
Block, yet those are never mentionned in the grammar save for ForBlocks and
Templates.
>From the meta-model described in the specifications, I would have expected
init sections to be useable on all blocks (if, let, file, query, macro,
...). Were they really meant to be accessible on for and template only?
No, you are right. It is meant to be useable on all blocks. We need to
fix the grammar.
Thanks, I'll consider init sections on every block until the spec is
fixed.
As a side note, what is the expected scope of these init sections?
Body of the block.
For example, can they be used in the declaration of the for's "iteration"
_expression_ or only in the body of the for block?
As per spec only in the body of a block.
Along the same line and
regardless of the answer of the former, can the variables declared in the
init section be used in the "each" _expression_ of the for since that can be
considered part of the body?
At the moment we do not consider "each" a part of the body. It is meant to
be executed between iterations, so not really considered a part of the body.
Do you feel it should be considered a part of the body? What about
'before' and 'after'?
I was thinking it could be a part of the body since, as far as the
generated code is concerned, the "each part appears within the scope of
the for. "Before" and "after" are clearly out of the body whichever
side we're looking at it. However I think you are right in saying
"each" shouldn't be considered a part of the body. Thanks for these
clarifications.
Regards.
Laurent Goubet
Obeo
Regards, Arjan
Regards,
Laurent Goubet
Obeo