This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 11733 - [F+O30] Casting to union types
Summary: [F+O30] Casting to union types
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 3.0 (show other bugs)
Version: Working drafts
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-11 11:25 UTC by Michael Kay
Modified: 2011-11-10 20:59 UTC (History)
2 users (show)

See Also:


Attachments

Description Michael Kay 2011-01-11 11:25:29 UTC
XPath 3.0 allows casting to union types.

There are several loose ends in the current specification.

(a) We currently allow casting only from string or untypedAtomic. In most other places in the language, we allow an xs:anyURI to be used anywhere an xs:string can be used. Should we allow it for casts also? Should this apply to all casts?

(b) Should we allow casting of a value A to a union type U if the type of A is a member type of U? This is a no-op, but users might expect to be able to do this, by analogy with the ability to "up-cast" say from my:hatsize to xs:integer.

(c) In the SequenceType syntax (as my:unionType) we allow a union only if it is a "plain" union, that is, a union whose ultimate member types are atomic values with no further restrictions imposed by the union (that is disallowing a union derived by restriction from another union). Should we restrict casting to "plain union" types for consistency, or should we allow casting to any union type? (If we do the latter, it would probably make sense to allow casting to any simple type, including a list. The semantics are perfectly well defined.)
Comment 1 Michael Kay 2011-06-28 15:50:15 UTC
The WG showed little enthusiasm for (a) but were keen to see a detailed proposal for (b) and (c).
Comment 2 Jonathan Robie 2011-11-10 20:59:48 UTC
This proposal was accepted at the XML Query/XSL WG Joint Teleconference #486 2011-10-04

(http://lists.w3.org/Archives/Member/w3c-xsl-query/2011Oct/0030.html)