Lists Home |
Date Index |
At 03:49 PM 7/3/2002 -0400, Simon St.Laurent wrote:
>At 03:00 PM 7/3/2002 -0400, Jonathan Robie wrote:
>>Sticks and stones can break my bones, but names can never hurt me.
>>Did you have a technical point to make?
>Yes, Jonathan. The very same point that you never care to listen to, but
>I can repeat it for you yet again if perhaps it will humor you.
>XML is a wonderful set of tools for marking-up information with labeled
>DTDs and RELAX NG pretty much acknowledge that foundation, and build on it
>cleanly. RELAX NG's use of structural patterns seems like a perfect fit
>for the capabilities inherent in XML and markup generally.
>W3C XML Schema throws away these understandings of labeled structures, and
>instead proceeds to create a mash of type systems which impose themselves
>on the structures of XML rather than meshing cleanly with
>them. Effectively, W3C XML Schema bolts a variety of understandings from
>the OOP and relational database worlds, and bolts them onto XML
>haphazardly, with no respect for notions like "element type definition"
>that came with XML 1.0.
>RELAX NG makes me think of a set of houses built to fit in their
>environment, with minimum impact on the surrounding terrain. W3C XML
>Schema makes me think of a subdivision built by clearcutting the area and
>then building houses according to plans that worked well enough someplace else.
>Perhaps that's merely an aesthetic point, something W3C XML Schema is
>notoriously bad at anyway. Technically, however, I think the impedance
>mismatch between W3C XML Schema and XML itself is severe, as W3C XML
>Schema's notion of type has only passing connections to XML 1.0's notion
>of type. The W3C seems more inclined to force these notions into XML and
>related technologies than to ask whether this is appropriate in the first
Here's the original message, to which I responded:
>So the named-typing mistake deepens. Now that's unfortunate.
Since this was the original message, I thought you wanted to say something
about named typing, which was the point of the message to which I
responded. You just said that you like RELAX-NG and DTDs a lot better than
you like XML Schema, but you haven't explained why you think named typing
is a problem or said much of anything about named typing.
Let me try to explain why I think named typing is good. Here's a function:
define function get-total( element invoice $i )
sum( $i//item/price )
This function assumes that the invoices it takes have been validated as
invoice elements according to some schema, and are not merely well-formed
elements whose name happens to be 'invoice'. At run-time, you don't want to
have to test every function parameter to see if it corresponds to a schema,
you simply want to ensure that the validator has said this corresponds to
the appropriate definition.
Named typing says that the validator indicates, with a type annotation,
that this invoice corresponds to a particular definition, and operations
that need to determine the type of an element need only look to see if the
appropriate type annotation is present. The opposite of named typing is
structural typing, which tests the entire structure. For XML, this is done
using structural subsumption.
Since you say named typing is a mistake, can you explain why you would
prefer structural subsumption to named typing for XQuery?