tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amos Shapira <amos.shap...@webcollage.com>
Subject RE: RE: If/Else tag?
Date Tue, 05 Jun 2001 06:11:57 GMT
Sorry, but if the purpose of taglibs is, among other things,
to make the code more readable and maintainable then such
tricks are not helping this goal, IMHO.

Also - what about nested "if/else"?

Starts to look like old-fasioned basic to me (the one on
Genie II and XT ROM Basic, not Visual Basic) :-)

I'll stick to scriptlets for now, as much as I'd like to
avoid them.

Cheers,

--Amos

-----Original Message-----
From: Mikko Kurki-Suonio [mailto:maxxon@neuslab.fi]
Sent: Tuesday, June 05, 2001 8:45 AM
To: 'taglibs-user@jakarta.apache.org'
Subject: Re: RE: If/Else tag?


On Tue, 5 Jun 2001, [utf-8] Amos Shapira wrote:

> I considered this but:
>  
> 1. It's not always clear (especially if the predicate is complex) that the
>     "else" predicate is the opposite of the "if".
> 2. Worse - whenever you change the "if" predicate you have to remember
>     to change the "else" too.  Very unmaintainable over time.
> 3. It's not clear that the two are actually related to each other.
> 4. You have to consider side-effects (as you said - if the "if" changes
>     "x", but also if the evaluation of "x" has side effects).

Simple. Just set a DIFFERENT flag variable whenever you trip the "real IF"
and test the _flag_ for the "ELSE".

In pseudocode:

x_else_flag = true;

if x then x_else_flag = false; blah blah blah;
if x_else_flag then do_the_else_thingy;

//Mikko


Mime
View raw message