Login
User name:
Password:
Remember me 
Powered by BlogHarbor
Powered by BlogHarbor
Re: Comparability
by Michael Kay
>Why on Earth is it necessary to raise an error when comparing *for equality* items of incompatible type? Well, it's not necessary. But it's one of those areas where the right answer isn't obvious. The argument is that if someone compares a date to a string then they've made a mistake, just as if they try and add two dates, and it's better to tell them so than to return false. I'm actually rather torn on this one. There are too many cases where XPath 1.0 makes it difficult for the user to diagnose errors because of the "never fail" philosophy. On the other hand, with an existential operator like "=", I feel the right answer would be to return true if any pair is equal, and ignore any pairs that are non-comparable (this isn't what the spec says, though).
Post comment:
  Receive comment notifications for this article
Subject: 
Comment: 
Comment verification:

Please enter the text you see inside the graphic to post your comment:
This blog does not allow anonymous comments. Please provide your username and password along with your comment.
Login information:
Username: 
Password: 
If you would like to post contact information on your comment, please enter your information into the optional fields below:
Contact information:
URL:  example: http://yourdomain.com