|
|
||||
|
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).
|
Search
Recent Comments
Recent Articles
Month Archive
|
|||