I had a twisted thought about a potential future thought experiment of using XML and Lisp style languages.

Having used Lisp a very little bit back in college for one semester, and read more about it in Structure and Interpretation of Computer Programs, I started looking into Clojure recently. I did a session of CodeRetreat last year in it, and was hearing more about it this year at SCNA so I started to read up on it more and play a little bit with the language.

Tie that in with that I recently was transferred to a new group at work that is doing some SOA (Service Oriented Architecture) work. Something triggered when I thought about the XML payloads being sent between the SOA Web Services and how that tied into what I am reading about Lisp and Clojure.

In other languages we think about serializing command objects into XML and back and send those messages between Services as a message payload. What made me think was that XML is a tree structure as well as the code in a Lisp type language.

What if we did something like Javascript and JSON? What if we convert the Lisp structure to XML and back, and then we can execute this Lisp structure data as Lisp code? With XML we can then also apply transforms and convert one message/command into another message/command, which would allow one message to be sent and transformed into multiple messages to be received by inserting messaging splitters and transformers. This is also not worrying about things like the security of the evaluation of the Lisp data as code since this something to think about as a thought experiment.

I don’t know if this is a novel idea, or if someone else has already tried it, but to me it seems like an interesting thing to think about and mull over.

3 thoughts on “XMLisp?

  1. Colin Jones

    Check out clojure.xml/parse and clojure.xml/emit – there’s a reasonably well-accepted structure here for going from XML->Clojure and Clojure->XML. This structure is also used for things like clojure.core/xml-seq and clojure.zip/xml-zip.

    There are also some design discussions going on for further core library xml enhancements that you might find interesting: https://groups.google.com/forum/#!topic/clojure-dev/3_jkBrdQKgs/discussion and http://dev.clojure.org/display/DXML/Fuller+XML+support

    1. Proctor

      I just saw something like this in “The Joy of Clojure” with the Clojure->XML example. What I was then thinking was then being able to eval that and having multiple representations of those XML commands. What seemed interesting was the possibility of XSLT to convert the XML message to multiple other commands, or to change the representation of the commands per receiver.

      Also the thought of implementing a distributed service oriented architecture style system using a Lisp language such as Clojure and being able to exchange messages as Clojure functions between the systems was an interesting thought to me.


Leave a Reply to Colin Jones Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.