This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
I can see that XQuery has been carefully defined so that Sequence Type Definition (under spec 2.5.3) is only part of the syntax construct rather than a type by itself. But has WG considered treating Sequence Type Definition as true data type which can be assigned to variables? In that way, complicated Sequence Type Definition can be used just by refering the variable rather than having to literally type it every time. And the variable can be passed to functions and the language become more flexible. I know that'll lead a lot of other questions, like how to compare meta type, how to construct dynamic meta type, etc. Is it because of those complicated issues that the WG is avoiding the issue in this version?
There are two comments here: (a) should types be first-class values (in the same way as many programming languages make Class a subclass of Object). This would also allow schema (or metadata) introspection in the same way as SQL and other database languages permit. The answer to this is yes, it should eventually be allowed, and it was a conscious decision to rule this out of scope for XQuery version 1. (b) should it be possible to declare the type of a variable or function dynamically? The answer is that this might make sense but only in the context of a dynamic evaluation capability (constructing XPath expressions from strings at run-time), which is something that again the WGs decided was out of scope for this round (the XSL WG in particular spent considerable time on this as the feature has often been requested.) Michael Kay (personal response)
Henry, Thanks for your comment. The Query working group discussed your suggestion on May 4, 2005 and decided that the functionality that you suggest is beyond the scope of XQuery Version 1. We will revisit this comment during discussions of a future version of XQuery. In the meantime, we consider this comment to be closed. Regards, --Don Chamberlin