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 29619 - [FO31] Casting to abstract types
Summary: [FO31] Casting to abstract types
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 3.1 (show other bugs)
Version: Candidate Recommendation
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
Depends on:
Reported: 2016-05-08 14:11 UTC by Abel Braaksma
Modified: 2016-05-24 16:07 UTC (History)
0 users

See Also:


Description Abel Braaksma 2016-05-08 14:11:08 UTC
Common sense seems to dictate that casting to abstract types is not allowed. However, the only hint I could find is in places where the text mentions that casting to xs:NOTATION is not allowed *because* it is an abstract type.

The closest I got was in 19.3.2, which says:

"It is always possible to cast an atomic value A to a type T if the relation A instance of T is true, provided that T is not an abstract type." 

However, this indicates that casting is *not always possible*. It doesn't (necessarily) say that casting to a parent that is abstract is *always* a failure.

Furthermore, sections 19.3.3 and 19.3.4 do not mention abstract types at all (and I'm unsure the text there covers TT of abstract type).

Unless I am misunderstanding these sections, I propose to add a (tiny) section under 19.3, something like:

19.3.1 Casting to abstract types
If TT is an abstract type, casting always fails. It doesn't matter in this case if TT is a parent type of ST, or if TT is equal to ST.
Comment 1 Michael Kay 2016-05-24 15:21:52 UTC
We concluded that the paragraphs in 9.1 that exclude casting to xs:NOTATION, xs:anyAtomicType, or xs:anySimpleType are adequate.
Comment 2 Abel Braaksma 2016-05-24 16:07:12 UTC
For sake of reference: during the discussion it became apparent that simple types cannot be abstract (by XSD rules), only complex types can, and that the text in the spec means "abstract type" in a different vein than the W3C XML Schema says.