XLANG and WSFL: Syntactic Arsenic


An Infoworld article by Jon Udell says:

XML is a lousy syntax for programming languages, and BizTalk developers have longed for something more programmer-friendly. For XLANG users, help is on the way, according to Dave Wascha, lead product manager for BizTalk at Redmond, Wash.-based Microsoft. XML should be used to specify service choreography, he says, but it need not be used to implement it. A conventional syntax can do this more naturally, as Microsoft has shown in experiments using C#.  

To which I would have to say: "AMEN."  It seems that the world has gone XML crazy lately.  Because of the hype, its not surprising that anything that can be, has been turned into XML.  Still, XML is lousy to read and write.  Programming language people have a term for making the syntax of a language pretty: syntactic sugar.  XML is syntactic arsenic. 

As I said earlier:

  • XML is just a context free grammar
  • A DTD is just a BNF
  • A DOM is just a parse tree
  • An XML parser does the same job as LEX/YACC except that its interpreted.

This last point is what gives XML its power.  Because the parsers are interpreted, they can be handed a schema (read: grammar) on the fly and parse what is thrown at them into a standardized parse tree (DOM).  Its a lot easier to transfer the schema around than compiled parsers for every grammar that someone might define.

Given that, XML ought to be used where this kind of on-the-fly interpreted parsing is useful.  Data is one such place.  On the other hand,  I've never understood the move to "orchestration languages" like XLANG and WSFL for precisely that reason.  After all, how are they different than programming languages?  There are two big points:

  1. They're different because they use XML.  OK, so how much better would Java be if its was parsed in an interpreted fashion using a grammar that was downloaded from Sun (the standard holder)?  Not much as far as I can see. 
  2. People claim that we need a "language independent" way to specify control flow.  Baloney.  There's no such thing since XLANG and WSFL are languages.  We could just as easily translate C# into Java as into XLANG.  I used to have my CS330 students do that sort of thing for a class project. 

Context free grammars are useful for doing lots of things.  I've maintained for years, tongue in cheek, that context free grammars are the only thing in computer science we really understand.  (That's why you had to take a compiler class: its the science part of computer science.)   XML plays to that strength.   Still, XML isn't the only way to do a context free grammar and is one of the worst from a human readability standpoint. 

All these XML standard definitions point out the big flaw in everyone's wishful thinking concerning XML.  To do what people want it to do, XML would have to be able to convey semantics.  Because its just a CFG, it can't.  So, the semantics have to live somewhere else: the standard and what people understand about it.  The problem is that as soon as you have a standard syntax, you've negated much of the benefit of on-the-fly parsing.  Am I happy for the standards? Yes!  Do they need XML? NO!   Free me from XML tyranny!