Comments on Staying Sane


I just read Clemens Vasters Staying sane in an XML Web Services World.  While there are some good things in there that I do agree with (like the immutability of XML Schema) I disagree strongly with his philosophical statements on semantics.  In particular, he says:

Using XML, we express semantics in a well defined way.

and

XML Schema is based on semantics. If the underlying semantics change so that they are largely incompatible with the previous semantics, the Schema changes and becomes a new one, even if it would be technically sufficient to express the new semantics.

This is just not true.  XML has nothing to do with semantics and the semantics could change drastically without any change to the schema.  You can't express semantics using a context free grammar---only syntax.  Certainly most XML (unless its nonsense) has a semantics associated with it, but the semantics is not expressed by the XML or its schema. 

Don't let someone tell you that they're going to express semantics in XML.  It can't be done.  The semantics will live somewhere else.   Here's a simple example from a programming language.  What does the following expression mean?

a + b

You can't tell: it might be simple addition, string concatenation, matrix addition, or even something I just made up.  Its meaning is context sensitive, for starters, since we'd need to know the types of a and b and even then, we can only guess what + means without a definition.  Yet, all of those semantic realities exist on the same piece of syntax: a + b.  The same is true of XML.  The schema, tells you the right form, but it doesn't tell you the meaning. 

This is junior level computer science.  You can express semantics in a number of ways:

  1. Operational semantics
  2. Translational semantics
  3. Denotational semantics
  4. Predicate-based (Hoare) semantics

None of these methods will work with a context free grammar like XML.  You need something at least as powerful as recursive functions (turing machines) to make any of these methods work.    (For a good introduction, you might look at Formal Semantics by Glynn Winskel.  There are lots of other good books on the subject that I'd be happy to point out--I've got a whole bookshelf of them.)


Please leave comments using the Hypothes.is sidebar.

Last modified: Thu Oct 10 12:47:20 2019.