Attila Szegedi wrote:
----- Original Message -----
From: "Tim Colson" <[EMAIL PROTECTED]>
To: "'Velocity Developers List'" <[EMAIL PROTECTED]>
Sent: Tuesday, July 01, 2003 10:07 PM
Subject: RE: Can comparisons be limited to true/false?



Not according to the FM documentation I read - FM does not throw an
exception when an IF conditional contains anytyhing other than a boolean
reference.



I don't know what documentation did you read, but
http://www.freemarker.org/docs/ref_directive_if.html clearly says "The
condition-s must evaluate to a boolean value, or else an error will abort
template processing".

Attila,


What this guy wants -- believe it or not -- is simply to disallow explicit comparisons on template pages. He wants to prevent people from writing:

#if (x == y)

and thus oblige the programmer to put a boolean variable xEqualsY in the context, despite the fact that both x and y are already in the context and could (with the usual disposition) be compared perfectly well.

Then anybody working on the template level would have to write instead:

#if (xEqualsY)

It seems a bit daft. You then have to document the existence of all these boolean variables. And then, when the template writer wants to compare x and z, say, and there is no ready-made boolean variable in the context for this, he has to come running to the programmer to ask for this.

AFAICS, this is based on some perverse, distorted version of the MVC paradigm.

Anyway, that's what Tim Colson wants, and it's nutty enough that neither you nor I, on first reading, quite grasped what he was asking for; we thought he just wanted the stricter semantics (as implemented in the "template engine that cannot be named") where a non-boolean in a boolean context (like a string or number or whatever) was considered an error.

<sigh>

Jonathan Revusky
--
lead developer, FreeMarker project, http://freemarker.org/
FreeMarker-Velocity comparison page, http://freemarker.org/fmVsVel.html


Regards, Attila.



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to