« The Economics of Colonizing Other Planets | Main | A New Version of Alloy »
Monday
Dec042006

Lisp as an 'Improved XML'

Steve Yegge's old blog, Stevey's Drunken Blog Rants, contains a lot of good reading for anyone interested in programming.  I particularly like his post The Emacs Problem in which he demonstates convincingly that the ancient programming language Lisp is better at representing structured text than the currently fashionable XML.  Here is a sample Java error log in XML:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE log SYSTEM "logger.dtd">
<log>
<record>
<date>2005-02-21T18:57:39</date>
<millis>1109041059800</millis>
<sequence>1</sequence>
<logger></logger>
<level>SEVERE</level>
<class>java.util.logging.LogManager$RootLogger</class>
<method>log</method>
<thread>10</thread>
<message>A very very bad thing has happened!</message>
<exception>
<message>java.lang.Exception</message>
<frame>
<class>logtest</class>
<method>main</method>
<line>30</line>
</frame>
</exception>
</record>
</log>

And here is the same in Lisp:

(log
'(record
(date "2005-02-21T18:57:39")
(millis 1109041059800)
(sequence 1)
(logger nil)
(level 'SEVERE)
(class "java.util.logging.LogManager$RootLogger")
(method 'log)
(thread 10)
(message "A very very bad thing has happened!")
(exception
(message "java.lang.Exception")
(frame
(class "logtest")
(method 'main)
(line 30)))))

Not only is the Lisp version shorter, less verbose and clearer, it also doesn't require you to learn another half dozen half-baked programming languages and frameworks in order to be able to write a program to read it and process it.

The older I get, the less patience I seem to have with unnecessary syntactic baggage, and more attractive I find Lisp's simplicity.  However, for the time being I think I will stick with Haskell.

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Hyperlinks will be created for URLs automatically.