[stringtemplate-interest] Limited control flow with
stringtemplate - by design?
Sohail Somani
sohail at taggedtype.net
Mon Nov 14 22:22:22 PST 2005
On Tue, 2005-15-11 at 07:17 +0100, Laurent Vaucher wrote:
> >
> > <if(number==SOMETHING)>blah<else>etc<endif>
> >
> > Is this possible? I'd rather use integral constants/enumerations
> > rather
> > than booleans...
>
> This is BAD!!! Oh, I'm not taking a religious or philosophical
> position, just repeating what I have read from the 'academic'
> article about StringTemplate (http://www.cs.usfca.edu/~parrt/papers/
> mvc.templates.pdf). One of the goals of the library is to enforce
> strict model-view separation by voluntarily making the template
> language non-Turing-complete. You're not supposed to compute things
> that the model part did not make explicitly available to the view
> part. You might like it or not, but that's the way of StringTemplate.
>
> Being a (not yet completely desintoxicated) JSP addict and using a
> lot of Java inside pages, I can understand the initial frustration.
Well that explains it. But I don't know if that makes things practical.
For example, you might have a template for type:
t = template("type");
t.setAttribute("name","double");
Now if you are translating into more than one language, where a double
can be Double, d0Ubl3 or double, it makes things very difficult.
Although I suppose this could be replaced by
t.setAttribute("name",template("double"));
:)
Sohail
More information about the stringtemplate-interest
mailing list