You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Peter Royal <pr...@apache.org> on 2003/06/11 21:55:24 UTC

[jexl] type coercion in LT/GT expressions

Any reason why jexl doesn't do type coercion with LT/GT expressions 
like it does for others?
-pete


Re: [jexl] type coercion in LT/GT expressions

Posted by Peter Royal <pr...@apache.org>.
On Wednesday, June 11, 2003, at 08:03  PM, Bill Keese wrote:
>> Any reason why jexl doesn't do type coercion with LT/GT expressions
>> like it does for others?
>
> I'm not sure, but possibly because it's dangerous, in the sense that 
> type
> conversion might not do what the programmer intended.  For example,
> would 9 > "10"  evaluate to true or false?   9 < 10

9 > "10" would be false. I am going to follow JSTL. If one of the 
arguments is a number, the other is coerced into a number

> but "9" > "10"

JSTL says that they should be compared lexically (ie 
String.compareTo()).

My specific need is for "1" > 0 to be true (string to number coercion 
when one argument is a number)
-pete



Re: [jexl] type coercion in LT/GT expressions

Posted by Bill Keese <bi...@tech.beacon-it.co.jp>.
> Any reason why jexl doesn't do type coercion with LT/GT expressions
> like it does for others?

I'm not sure, but possibly because it's dangerous, in the sense that type
conversion might not do what the programmer intended.  For example, would 9
> "10"  evaluate to true or false?   9 < 10 but "9" > "10"

Just a guess,
Bill

----- Original Message ----- 
From: "Peter Royal" <pr...@apache.org>
To: <co...@jakarta.apache.org>
Sent: Thursday, June 12, 2003 4:55 AM
Subject: [jexl] type coercion in LT/GT expressions


> Any reason why jexl doesn't do type coercion with LT/GT expressions
> like it does for others?
> -pete
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>