- From: Noah Mendelsohn <nrm@arcanedomain.com>
- Date: Sat, 19 Mar 2011 11:42:00 -0400
- To: "Costello, Roger L." <costello@mitre.org>
- CC: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
On 3/19/2011 9:44 AM, Costello, Roger L. wrote: > Thus the element declaration for Publisher is not context-free. Its type is very much dependent on its context. Roger, I respectfully disagree. In your example, the Publisher element is (has values that are) of type xs:string. It is also the case that, per the assertion, we can state some further restrictions, but those are not modeled as changing the type. If someone wrote in XQuery a function that required an argument of type "xs:String:", then >atatic< type checking could be used to prove that passing the (value of) a Publisher element would be ok. It's in that sense that it is so important that types be context free. Similarly, anyone building a data binding tool to Java, for example, can depend on all Publisher elements being of type String. The case is perhaps more compelling for a return type. Let's say you make up some type T that happens to involve assertions, and you write an XQuery function that has T as its return type. With the current system, it's straightforward to check that the value constructed by the function matches its type signature. If types are context dependent, then it's not entirely clear that doing such checking is even coherent for newly constructed subtrees. At the very least, you'd probably have to hoke up some context, and with high likelihood, assertions would fail anyway (e.g. due to failure to find ancestors of the newly constructed value.) Noah
Received on Saturday, 19 March 2011 15:42:29 UTC