You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Dave Cramer <Da...@micro-automation.net> on 2001/07/20 12:25:10 UTC

Observation

I had a quick look at the code, and it looks like 

#if ($Object.Long == $Object.Integer) would return false even if they
were equal in value

Most compilers deal with this by promoting the smaller object to the
larger, but this adds a lot of overhead.

A really easy way to deal with this is see if both sides are instances
of Number and then compare their toString values. 

I haven't tried the above so if I'm totally out of it, please ignore

Dave


Re: Observation

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Dave Cramer wrote:
> 
> I had a quick look at the code, and it looks like
> 
> #if ($Object.Long == $Object.Integer) would return false even if they
> were equal in value

Yes - we don't do comparisons of anything but Integer and String.  It's
something we are working on, carefully.

> 
> Most compilers deal with this by promoting the smaller object to the
> larger, but this adds a lot of overhead.

Yes, and this isn't a programming language. :)
 
> A really easy way to deal with this is see if both sides are instances
> of Number and then compare their toString values.
> 
> I haven't tried the above so if I'm totally out of it, please ignore

No, this is valid.

geir

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!