[stringtemplate-interest] Conditional statements
dmoshal at gmail.com
Sat May 6 12:51:32 PDT 2006
I have to admit that I wouldn't mind expression and logic evaluation
capabilities in the view (template),
seems to me that this ought to be possible without risking the view:
- changing the model, or
- becoming a controller.
My problem with the current system is that if one is passing in a collection
the lack of logic or expression evaluation in the view requires one to
1. create custom view objects from the model (which reduces performance), or
2. alter the model, so that these objects fit the view (which breaks MVC
I've always thought that extreme MVC separation isn't the goal, but rather
that each element of the
M,V and C, should contain elements of all three, with particular emphasis on
Indeed, this is currently the case with ST, which supports $if$ anyway (a
And the template itself is persistent, so it is a Model for the View.
My ZAR 0.02.
On 5/6/06, Kay Roepke <kroepke at dolphin-services.de> wrote:
> On 6. May 2006, at 3:46 Uhr, Galen Dunkleberger wrote:
> > However it's my
> > opinion that by allowing multiple conditions for an if statement you
> > simplify the template...and what I like about string template is it's
> > simplicity.
> While I can understand your request and do support it (sorta ;)), I
> it should be well considered to add expressions, even if they are "just"
> boolean. It might awake those sleeping wishes for full fledged
> and such beasts (aka The Bad Thing(tm)).
> As a workaround you can always provide template variables which have the
> value of those boolean expressions if that would make your life that
> much easier.
> After all the controller is allowed to know about the logic of the
> view. It still
> wouldn't compromise the MVC pattern of ST, as long as there isn't any
> actual text in
> the controller.
> This is the way I handle things at work (where we have a template
> system quite similar to
> ST) and that works pretty well. Having boolean expressions naturally
> simplifies things when
> the requirements change, but it would require some work in the
> grammar (which may or may not
> be easy/quick to do, I don't know for sure).
> My €0.02
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the stringtemplate-interest