RE: question about subtyping and type annotations
"Michael Rys" <[email protected]> Thu, 23 Feb 2006 20:41:57 -0800
| Newsgroups | gmane.comp.web.query-languages |
|---|---|
| Message-ID | <07D2490E9E33124B8ED67F01E828B9E715DE9E@RED-MSG-70.redmond.corp.microsoft.com> |
I agree with your assessment that xs:integer(xs:byte(100)) should have a type annotation of xs:integer. Mike apparently disagrees. You should file a Mozilla request to add this to the test suite. Best regards Michael=20 > -----Original Message----- > From: [email protected] [mailto:[email protected]] On=20 > Behalf Of Per Bothner > Sent: Thursday, February 23, 2006 7:30 PM > To: [email protected] > Subject: question about subtyping and type annotations >=20 >=20 > I'm unclear on the semantic model for type annotations, and I can't > find a clear answer in the specifications or in the test suite. >=20 > I gather (and Saxon agrees) that: > 100 instance of xs:byte =3D=3D> false > because 100 has "type annotation" xs:integer, which is not a sub-type > of xs:byte. >=20 > Using the cast xs:byte creates a value with type annotation xs:byte: > xs:byte(100) instance of xs:byte =3D=3D> true >=20 > What about xs:integer(xs:byte(100))? I would expect this to return > a value with type annotation xs:integer, but Saxon (b8-6-1) disagrees: > xs:integer(xs:byte(100)) instance of xs:byte =3D=3D> true ???? >=20 > This implies that if the argument already conforms to the=20 > casted-to-type > then it it returned changed. That is certainly a possible behavior, > but another behavior is that casting to xs:integer returns a value > with annotation xs:integer. That seems more consistent to me. >=20 > The formal semantics just refers to chapter 17 of Functions and > Operators, which mainly specifies which conversions are valid. > The formal semantics should probably specify the resulting "formal > values" after a cast. >=20 > Either way, this should be tested in the test suite. I didn't > find it (using a quick grep). > --=20 > --Per Bothner > [email protected] http://per.bothner.com/ >=20 >=20