I too like the TemplateNumber deal.
And the < > etc for Comparable's is a good idea and
could be done fast.
String coercion to Number might be neat but it's not
a big issue for me, and I agree it could wait even
if it were a big issue.

Back to TemplateNumber.
For ASTEQNode/ASTNENode (==/!=) should the test for the
same class come before the test for instanceof TemplateNumber ?
Presumably equals() is cheaper than 2 getAsNumber() followed
by 2 convertToBigDecimal() and finally a compareTo().
It also bypasses conversions when comparing two Integer's, Double's,
whatever. It just needs to be explicitly documented to
TemplateNumber implementors what's happening.

        if (left.getClass().equals( right.getClass() ) )
        {
            return left.equals( right );
        }

        /*
         *  convert to Number if applicable
         */
         if (left instanceof TemplateNumber)
                left = ( (TemplateNumber) left).getAsNumber();
         if (right instanceof TemplateNumber)
                right = ( (TemplateNumber) right).getAsNumber();

         if (left instanceof Number && right instanceof Number) {
         ...
         }

         /* error code ... */
         rsvc.error(...);
         return false;

John Allison
[EMAIL PROTECTED]

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

Reply via email to