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

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 UTC