[stringtemplate-interest] [ST4] How to avoid map key iteration?

Terence Parr parrt at cs.usfca.edu
Tue Feb 15 14:45:27 PST 2011


On Feb 14, 2011, at 1:20 AM, Udo Borkowski wrote:

> Hi Sam,
> 
>> If you write it this way:
>>  ...
>>  <t2(adr=p,line2={<adr.city>, <adr.zip>})>
> 
> Good point.
> 
> I guess it is just my personal style (and background) that makes me raise the issue. Inside a subtemplate I'd prefer to access the parameters of the subtemplate (the {p1,p2|…}) over the access of something outside of the subtemplate, especially with the dynamic name lookup of ST4 in mind.

In ST v4, the default args are formally defined to have the same context as the template itself, hence, default arguments can see the other arguments.

Ter


More information about the stringtemplate-interest mailing list