- From: Robie, Jonathan <jonathan.robie@emc.com>
- Date: Tue, 29 Sep 2015 12:09:09 +0000
- To: Michael Kay <mike@saxonica.com>
- CC: Abel Braaksma <abel.braaksma@xs4all.nl>, Public Joint XSLT XQuery XPath <public-xsl-query@w3.org>
Mike Kay wrote: >> We disallow it for variable bindings (type error), but allow it for all other uses of sequence type. > > I don’t think we “disallow" it, any more than we disallow division by zero. > > If you’re referring to the sentence "A variable binding with a type declaration xs:error always raises a type error.” > then my interpretation of that sentence is that it’s simply a redundant statement of fact: > > (A) (3.11.1) At run time, if the value bound to the variable does not match the declared type > according to the rules for SequenceType matching, a type error is raised [err:XPTY0004]. > (B) no value matches the type xs:error > (C) Therefore, if the declared type is xs:error, a type error is raised, whatever the value. 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 Castable is not a problem, it could always return false, ditto for instance of, typeswitch can simply not match. 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. Jonathan
Received on Tuesday, 29 September 2015 12:09:59 UTC