[Zope-dev] ZPT and 'else'

Marc Lindahl marc@bowery.com
Fri, 10 May 2002 11:25:52 -0400


on 5/10/02 12:47 AM, Jeffrey P Shell at jeffrey@cuemedia.com scrivened:

> 
> You would need something to close off the 'if' statement, otherwise, a
> document full of 'if' statements and no 'else' ones could fill up a stack
> needlessly.

What's so bad about that?  The stack wouldn't carry over after <html></html>
or <body></body> - couldn't practically more than 1000's - insignificant!

> 
> You would at the very least need something like:
> <condition>
> <if>...</if>
> <elif>...</elif>
> <else>...</else>
> </condition>
> 
> Which would ensure / cut back on needless growth of stacks and/or global
> variables.
> 
> Personally, I think the way Page Templates can do it (via a 'not'
> expression) is fine.  When I used it today (and in the past), I never felt
> myself missing 'else', because there's not really an 'if' to begin with.
> Just conditions.  It keeps TAL light, and lets TALES take on the lifting of
> how to write those conditions.

Point is, it's slow and inefficient, and a clunky syntax.  Reasons the whole
idea of 'else' was invented in the first place.  I worry, that ZPT is
benchmarked 4x slower than DTML and it's becoming the standard - not a step
forward.  And issue like this haven't been satisfactorily resolved.

I think, if it's going to have logic in there, make it sufficiently powerful
and efficient.  Otherwise get rid of it altogether, unapologetically, and
require Python for such things....