- From: Abel Braaksma <abel.braaksma@xs4all.nl>
- Date: Tue, 29 Sep 2015 14:28:24 +0200
- To: "'Public Joint XSLT XQuery XPath'" <public-xsl-query@w3.org>
>
> But why is that said just for variable bindings, when there are other uses of
> SequenceType such as parameter types that should act the same way? I
> would think this includes:
>
> * Function parameter types (including inline, found in XPath)
> * Function return types (including inline, found in XPath)
> * Treat as
> * Cast as
Exactly, the problem I tried to raise in the bug report was that of "binding" and "always raises", which seems like a special treatment of type errors involving xs:error.
>
> Castable is not a problem, it could always return false, ditto for instance of,
> typeswitch can simply not match.
Except for, surprisingly:
let $e as xs:error := xs:error(1)
return $e castable as xs:error
I think it is arguable whether this should return true or raise an error. A processor could detect that $e is of type xs:error, ignore the assignment and return true. Or is that an illegal optimization?
Another issue is with an XSD declaration like:
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:int" />
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="xs:error"/>
</xs:simpleType>
</xs:union>
A variable bound to a union type as this should, I think, return true for castable as and, possibly, instance of? And then it will throw when actually casting....
>
> I can't remember who asked this text to be added in June 2013, we should
> probably check the decision record and make sure we understand the
> motivation.
The link was in my first reply: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20634
Cheers,
Abel
Received on Tuesday, 29 September 2015 12:29:00 UTC