- From: Jerome Simeon <simeon@us.ibm.com>
- Date: Fri, 24 Feb 2006 20:56:06 -0500
- To: "Michael Kay" <mhk@mhk.me.uk>
- Cc: "'Per Bothner'" <per@bothner.com>, www-ql@w3.org
Right. and I think that from the paragraph about casting that you quoted it is clear that you get the type annotation of the type into which you are casting. It seems the most natural semantics in a number of ways. Notably it is useful is the user wants to explicitely set the type annotation, as in: xs:byte(1) or in case of casting from another type: xs:integer("1") I think people will find it confusing if you change the type annotation behind their back. I also remember that one feature that was discussed at some point for XQuery was something like Expr instance of only xs:integer, where you want to check for the type annotation but not one of its derived types. That kind of feature won't really make sense if we let implementation pick up a derived type arbitrarily. The rules about type substitutability is not about giving implementations the freedom to chose the type annotation. I think the language is pretty deterministic in that sense. When you validate or cast you get a specific type annotation. When you pass the value to the function you preserve the existing type annotation. That should helps interoperability. - Jerome "Michael Kay" <mhk@mhk.me.uk> wrote on 02/24/2006 11:57:55 AM: > > Section 3.12.5 Constructor Functions seems to be pretty clear > > about it: > > That only says they are equivalent to casts. Are casts exempt from the > general rule of substitutability, which says that any expression can return > a value whose dynamic type is a subtype of the required type? > > Michael Kay > http://www.saxonica.com/ > >
Received on Saturday, 25 February 2006 01:56:14 UTC