[stringtemplate-interest] Bug/Problem passing parameters into iteration

Mike Goodwin mike.goodwin at cantab.net
Fri Nov 5 18:39:55 PDT 2010


Hi Terence,

> element(el,x)::=<<
> $x$$el.name$<br>
> $x$$el.children:element(el=it,x=x+" ")$
>>>
> tree(root)::=<<
> <html>
>        <body>
>                <code>
> $root:element(el=it, x="")$
>                </code>
>        </body>
> </html>

I find the scoping implications/rules a bit confusing. Looking at
this, twice we have el=it. The 'it' presumably comes from the scope in
that of the template we are calling. How could we then refer to the
outer 'it' in the setting expression? What about the x  ... etc.?

The extra template was being used, but had been simplified whilst
trying to get things working.

- mike


More information about the stringtemplate-interest mailing list