RE: Casting/constructors should accept the empty sequence

Here is an out-of-the-box suggestion.  Remove the verbose cast syntax.
Allow two signatures for each constructor function;

	one that accepts the empty sequence and one that does not.  For
example:

	xs:integer(anyAtomicType)

	xs:integer?(anyAtomicType?)

	The only problem with this suggestion is that you will not be able
to cast/construct user defined datatypes defined in the null namespace 

	if the null namespace is used as the default namespace for
functions. 


I quite like this.

We could solve the "null namespace" problem by changing the XPath grammar so
that wherever it currently uses the QName production, it is changed to use a
new construct NQName, where NQName allows either a lexical QName, or ":name"
to refer to the expanded QName that has local part "name" and is in the null
namespace. (We could encourage XML and XMLSchema to adopt the same
convention where they use QNames, but we could do it for XPath QNames
independently).

Extending the syntax of function calls to allow xs:int?(3) is a bit tricky,
and the effects might be a little pervasive. We could define it as custom
syntax, however. In fact, we could then make the parens optional, allowing
xs:int? 3

Michael Kay

	 

	 

Received on Sunday, 30 May 2004 18:19:50 UTC