[stringtemplate-interest] Conditional statements

Terence Parr parrt at cs.usfca.edu
Sat May 6 15:14:44 PDT 2006


On May 6, 2006, at 1:15 PM, David Moshal wrote:

> Kay - let me play Devil's advocate here a bit.
>
> Take the issue of Formatting of dates and numbers. This is a case  
> of applying
> an expression to the model, to create a particular view of the data.
>
> With ST currently if one wants to create, a table by iterating  
> through a collection of objects,
> in which the cells need to be formatted in a particular way, those  
> objects need to provide the formatted
> 'view' of the model, so either one creates custom objects in the  
> controller, applying the formatting rules
> to the model, or one alters the model object, so that it knows how  
> to format it's data for the view.

please see my elegant solution to this problem w/o breaking the  
sanctity of MVC separation (better solution than turing complete  
templates I might add):

http://www.cs.usfca.edu/~parrt/papers/i18n.pdf

> So, in the case of formatting, wouldn't it be helpful if the  
> template had some
> evaluative capabilities that go beyond boolean evaluation??

I submit that it is unnecessary and worse just make ST an "me too"  
engine; nothing special.  ;)

Ter


More information about the stringtemplate-interest mailing list