W3C home > Mailing lists > Public > public-qt-comments@w3.org > September 2010

[Bug 10291] Test /SchemaImport/SchemaImportProlog/modules-schema-context should accept XPTY0004 as valid result

From: <bugzilla@jessica.w3.org>
Date: Sat, 11 Sep 2010 20:13:27 +0000
To: public-qt-comments@w3.org
Message-Id: <E1OuWRz-0005Ys-1g@jessica.w3.org>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=10291





--- Comment #6 from Michael Kay <mike@saxonica.com>  2010-09-11 20:13:26 ---
Yes, comment #4 is proposing a modification (or clarification) to the spec.

The reason for not proposing any change to the static context rules is that
XQuery is designed to allow modules to be independently compiled, so we
minimize the amount that the compiler needs to know about the query as a whole
when compiling a single module. (The fact that XSLT has a global static context
is the main reason that XSLT stylesheet modules cannot be separately compiled.)
But this argument doesn't apply at run-time; I think it's reasonable to assume
that at run-time, the processor has access to (at least) the union of the
schema components in the static contexts of all modules. Alternatively, we
might define that all types used during validation of instance documents are
"known" types for the purpose of section 2.5.4 - so if you are looking at a
node with a particular type annotation, that type is by definition a "known"
type.

I agree that contradicts what we currently say "An unknown schema type might be
encountered, for example, if a source document has been validated using a
schema that was not imported into the static context." But I think this test
case demonstrates that this isn't viable - it makes it impossible to write
interoperable queries. A function is always allowed to return a value that
belongs to a subtype of the type appearing in the function signature, and if
there is no guarantee that the caller of the function (who only knows about the
declared type) can handle this value, we lose substitutability and this is so
fundamental to the language design that it's not a viable option.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Saturday, 11 September 2010 20:13:28 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:15:06 GMT