I find that this topic is one upon which people often have strong opinions. I don't wish to fan the fires of this debate, but I have one small thing to say.
The Web would have been more successful if another structure had been
used.
I'm not sure about that. Even now, I sometimes use a text editor to edit my HTML files. Imagine if I wanted to italicize a single word in a large document. In HTML I simply wrap that text with <i>. But if HTML had used an S-exp syntax, I would have to perform the following operation:
Starting with: (html (body "........large block of text..........."))
Split it into: (html (body "........block1......." "word-to-be-italicized" "......block2......"))
Wrap it with the i tag: (html (body "........block1......." (i "word-to-be-italicized") "......block2......"))
It would be difficult to perform this operation while keeping the document somewhat comprehensible, whereas in HTML the <i> is quite unobtrusive to the eye.
Perhaps in these modern times I shouldn't still be using a text editor for this. At the very least I should use some sort of structure editor, or some Emacs macros. But imagine how this issue would have slowed the adoption of the early Web.
I'm making a historical point only. That markup languages won in this particular domain at this particular point in history doesn't mean they're actually a good solution to other problems. But I think it's worth understanding why they won.
Vish
On Sat, Oct 10, 2009 at 2:46 PM, Rudolf Olah omouse@gmail.com wrote:
Vishvajit Singh wrote:
My simple approach to the question of markup languages vs. s-expressions is:
Generally prefer s-exps for structured data, but in the special case of data in which the leaf nodes are the main player, containing most of the data, then markup languages sometimes make sense. So, for example, web pages are mostly text, so it's annoying to worry about the text being an element within a larger tree. It's easier to consider the text as the main player, with "markup" around it.
Markup languages are a horrible idea. They mix the idea of content with structure and with style. Content can be made to fit within different structures and different styles can be applied to those structures. Markup makes it impossible to cleanly copy content from page to another because you have to first remove the structure.
Ted Nelson wrote about why markup languages are awful: Embedded Markup Considered Harmful --> http://www.xml.com/pub/a/w3j/s3.nelson.html
So, the original idea of HTML is a great idea. The web would have been less successful if they had chosen a sexp-based syntax, because it would have been more difficult for ordinary people to create their own webpages.
The Web would have been more successful if another structure had been used. As it is, almost no one can use or design a graphical tool for designing web pages because of the HTML mess. You aren't supposed to deal directly with the data format because you could make a mistake and make it invalid. We don't edit music file tags directly by hand, do we?
However, I think extending this idea to the problem of general data representation is a bad one. XML is overly verbose (the name of every node in the tree needs to be entered twice) and therefore hard to read. And don't get me started on XSLT.. I spent a summer working with that once. (Not something I wish to remember.)
In the general case of arbitrarily structured data, I think s-exps are both easier to parse and more human-readable than XML.
Depending on the structure, it might be better to store it as a binary file of some sort and then give tools to users/developers to interact with the data in a safe way. I have never understood why we don't trust data from the user and clean it up in web & desktop applications but then completely ignore that when it comes to configuration files, XML, HTML, etc.
It all comes down to trade-offs and determining what the goals of the data format are.
So Mr Penton, if you want to use s-expressions instead of XML-looking markup, then you'll have to determine what the goal of XML is and whether or not it is worthwhile to follow in their footsteps. Remember, not everything is best represented as a tree.
-Rudolf Olah