[stringtemplate-interest] Managing "type specific" subtemplates

Terence Parr parrt at cs.usfca.edu
Tue Dec 9 13:48:05 PST 2008


On Dec 9, 2008, at 10:55 AM, Nathan Ward wrote:

>
>> Sure. or even just set an attribute to the template name and then use
> (name)().
>
> That only works if there is only one case in the templates where  
> there are
> type specific subtemplates. I am ending up with several templates  
> that type
> specific and are referenced in various other templates. Hence, looks  
> like
> the way to go is a simple template map.

yep, that works well then.

> There doesn't seem to be much other
> choice with in StringTemplate, but I think this is fine. I'm  
> basically using
> a template map to implement a "case/switch" construct, but I very much
> appreciate that StringTemplate enforces separation between model and  
> view.
> So, this is a small price to pay.

Yep, ST is occasionally annoying but is the price we pay for strict  
separation. :)

Ter


More information about the stringtemplate-interest mailing list