On 21/01/2013 01:50, David Lee wrote:
This is interesting.
I tried this in a couple XQuery parsers and they all report an error
1 treat as xs: untypedAtomic
Reading up on "treat as" is a bit confusing to me. "cast as" works as
defined
1 cast as xs: untypedAtomic
We've got used to the fact that languages like Java use the word "cast"
to mean two different things: to invoke a conversion to a specified
type, and to assert that the value is already a specified type, in order
to pass static type checking. XQuery uses "cast as" for the first
purpose, and "treat as" for the second.
(AFAIK, the word "cast" was first introduced to computer science by
Algol 68, where the two operations were called coercion and casting
respectively. So this choice is historically unfortunate.)
Because "treat as" is an assertion designed so the query author can tell
a pessimistic static type checker to get out of the way and mind its own
business, it is needed only in systems that do pessimistic static type
checking, which are very few and far between. (Galax and SQL Server are
the only ones that come to mind).
Michael Kay
Saxonica
_______________________________________________
[email protected]
http://x-query.com/mailman/listinfo/talk