velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tal Dayan" <>
Subject RE: Integers and numbers in a comparison expression
Date Sat, 14 Jul 2001 03:58:29 GMT

> > The condition failed even though $num was higher than 7.
> >
> > Why not to throw an exception if the type of $num is invalid for
> > the expression ?
> We could - we already log it.  An exception might be the way to go...

Oh, there is a log, I was not aware of it. Where is it found ? We are using
the Velcoty app class and don't have any special configuration for the log,
are just configuring the the template loaders.

> > Also, without knowing much of the Velocity code, it looks to me that
> > it would not be that difficult to convert a String value "134" to
> > an integer when a integer value is required in the expression.
> For example,
> > one can write a generic method getIntegerValue(Object)->int that gets
> > String, Long, Float, etc and converts then to an int. If the type
> > of Object is invalid or the value does not represent an valid
> numeric value
> > than it can throw an exception. Am I missing something ?
> No - we've gone over this a few times. It is easy to do, but we wanted
> to keep things simple.

Do you mean simple implementation or simple to the designer that
use the template ? For the user, the ability to use strings in the
expression will
be simpler IMHO.


View raw message