|
|
||||
|
Re: Comparability
by
Dimitre Novatchev
Thanks for these "easy ways".
Why on Earth is it necessary to raise an error when comparing *for equality* items of incompatible type? If they are of incompatible type, this already means that there's *no* way they can be equal.
It seems to me, that whoever imposed raising eror in this case tried to enforce a kind of religion on the developers using XPath. This is a specific example where static type-checking is overdone and clearly does not help (but obstructs).
To what result? So that now we have to rely on word of mouth (sorry, Mike), even if this comes from Michael Kay himself, and subconsciously "feel guilty" -- not knowing even for what... :(
Yes, having a sequence of incompatibly typed items is not a good practice, like having an array of Object, but maybe sometimes there are cases when we are forced to accept that we do not know the type in advance. XPath 2.0 does not have Haskell's "type class" facility, so one is forced to use
item()*
in this case or not to specify a type at all.
It is good to have a backdoor and I thank Mike for achieving this. However, should I "feel guilty" for using this backdoor?
FXSL has a set of type-processing functions that can determine dynamically the type of an item and return it as a string or return the constructor function for this type. This could be used to determine type (in)compatibility in case the backdoors Mike points out did not exist.
Cheers,
Dimitre Novatchev
|
Search
Recent Comments
Recent Articles
Month Archive
|
|||