Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are s-expressions not used compared to JSON and XML?

Why are s-expressions popularized by Lisp not considered as an option relative to JSON and XML? Is there some defect to them that made the Lisp s-expression never catch on?

like image 233
user782220 Avatar asked Oct 08 '13 03:10

user782220


1 Answers

Any reasonably regular, reasonably simple, reasonably compact syntax will work just fine. And programmers have a habit of inventing new ones either to "fix" things they didn't like about an earlier syntax or simply to make it obvious at a glance which markup is being used. Basically, Michael Kay's answer is correct -- it's a fairly arbitrary choice, and the basic answer is "because JSON and XML didn't happen to go that way."

There are probably some actual reasons, though.

For example, XML was designed to be mostly compatible with SGML-based document processors (HTML is SGML-based, for example), since at the time it was being thought of as an attempt to create an easier-to-work-with subset/substiset of SGML. That gave it the basic angle-bracket-and-attributes syntax. The rest has evolved from that starting point. This was absolutely the right choice early in XML's evolution since it let people take advantage of some existing SGML tooling and tap into an existing SGML user community. Now... it is what it is, and there's no good reason to change it.

I can't vouch for what inspired the decisions behind JSON's syntax, other than some of it being in reaction to perceived (and exaggerated) disadvantages of XML.

Lisp S-expressions have as many detractors as fans... among those who actually remember them at all. There used to be an old joke that LISP stood for "Lots of Irritating, Silly Parentheses." They're easy to parse... but in the end not significantly easier than the alternatives.

like image 180
keshlam Avatar answered Sep 23 '22 09:09

keshlam