[stringtemplate-interest] Conditional statements
Kay Roepke
kroepke at dolphin-services.de
Sat May 6 09:59:39 PDT 2006
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
think
it should be well considered to add expressions, even if they are "just"
boolean. It might awake those sleeping wishes for full fledged
arithmetics
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
-k
More information about the stringtemplate-interest
mailing list