3 ms·
I used to spend a lot of time manually typing up examples of why S-expressions are cleaner and more readable than XML, HTML, JSON, YAML &c. They are, they real
by zeveb 7y ago
I used to spend a lot of time manually typing up examples of why S-expressions are cleaner and more readable than XML, HTML, JSON, YAML &c. They are, they really are. And yet for some reason there's a population of people who prefer:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>sample page</title>
<link rel="stylesheet" href="sample1.css"/>
</head>
<body>
<h1>sample</h1>
<p>
text sample
</p>
</body>
</html>
to:
(html ((lang . "en"))
(head nil
(meta ((charset . "utf-8")))
(title nil "sample page")
(link ((rel . "stylesheet") (href . "sample1.css"))))
(body nil
(h1 nil "sample")
(p nil "text sample")))
I don't understand it, but it seems to be true. The egotistical part of me feels that they just haven't experience the enlightenment of understanding the benefits of have all data & code be manipulable, structured data rather than dead text which must be painstakingly parsed, combined with the benefits of a single, general, universal, cheaply-parseable representation.
But the professional, open-minded part of me wonders if maybe I am missing the point. Maybe all that painful-to-parse, irregular syntax is buying something. Maybe there's a reason every generation for the last 50 years has been approximating some but not all of the features of Lisp. Maybe those other languages and formats have worthwhile benefits. Maybe they're even superior.
Or maybe most folks really are stuck in a local maximum, like kids who like being read to and don't see the advantage of learning to read. I honestly don't know.
Regardless, SEML looks great.
- MikusR 7y agoQuoting the page: "SEML is short and easy to understand for Lisp hacker." For someone that has edited a couple of html pages but is not a programmer SEML looks like gibberish (who is nil?).
- zeveb 7y agoHonestly, SXML is probably cleaner and easier than SEML. The example in SXML would be: (html (@ (lang "en")) (head (meta (@ (charset "utf-8"))) (title "sample page") (link (@ (rel "stylesheet") (href "sample1.css")))) (body (h1 "sample") (p "text sample"))) The great thing about standards is that there are so many to choose from.
- kazinator 7y ago> who is nil A noun in the English language, of Latin origin. https://www.merriam-webster.com/dictionary/nil https://www.merriam-webster.com/dictionary/nil
- nfoz 7y agoYour example (and all the SEML documentation it seems) is missing marked-up text. For example, how would you represent: <p>This is a <b>really cool</b> sentence.</p> Your solution will probably have to splice the text segments around the embedded markup, something like: (p nil (text "This is a " (b nil "really cool") " sentence.")) In particular, notice the careful whitespace at the edges of the strings. IMO this Sexpr is now more obtuse than the XML, and the more markup you have within text-spans (e.g. nested markup), the worse it gets. This is also a major difference between XML (markup language) vs JSON (data-structure notation). Maybe you don't need the (text ...) thing, but either way you're changing the grammar. How do SEML and SXML handle this?
- undersuit 7y agoThe issue is the spaces, so let's get rid of them! (p nil (text (string-join '("This" "is "a" '(b nil "really") '(b nil "cool") "sentence.") " "))) No more wondering if the space between 'really' and 'cool' should be bold and no need to have awkward preceding and trailing padding.
- zeveb 7y agoI think that's mostly an artifact of SEML. In SXML that would be: (p "This is a " (b "really cool") " sentence.") Which seems a-okay to me.