<story><title>That people produce HTML with string templates is telling us something</title><url>https://utcc.utoronto.ca/~cks/space/blog/programming/OnHTMLViaStringTemplates</url></story><parent_chain><item><author>idlewords</author><text>Another reason you won&amp;#x27;t find people using string templates to produce HTML in Lisp is that no one uses it for web development. This phenomenon where multiple language features conspire to prevent misuse is called defense in depth and is one of the great strengths of the language.</text></item><item><author>hajile</author><text>Yet another incident of Greenspun’s Tenth Rule.&lt;p&gt;Lisp macros make adding HTML syntax easy. You won’t find anyone using string templates in that language because a handful of macros means you can just program like it’s just lisp.&lt;p&gt;Strings such primarily because they don’t establish regularity. If you don’t understand everything fully and follow their patterns exactly, it’s easy to accidentally lose your pseudo-macro hygiene and output garbage.&lt;p&gt;JSX was a revelation simply because it was a “macro” (DSL) that ECMA had already designed an entire spec around (E4X) and thoroughly baked into the language. Like with Lisp, you could just use your normal coding patterns to interface.&lt;p&gt;A custom HTML macro baked into the syntax makes sense in a language where almost everyone using it is going to need HTML. It would make far less sense to dedicate all that syntax space in a more general purpose language.&lt;p&gt;And in JS, even with all that design time spent on E4X, you are still back to doing string interpolation the second you step away from that specific syntax (or you’re forced to express everything as HTML even if it’s not a good fit).&lt;p&gt;The world would be a better place if JS had been scheme and people had been forced to learn a lisp.</text></item></parent_chain><comment><author>manicennui</author><text>Except, you know, the site you are using right now, and a large number of sites that use Clojure&amp;#x2F;Clojurescript.</text></comment>
<story><title>That people produce HTML with string templates is telling us something</title><url>https://utcc.utoronto.ca/~cks/space/blog/programming/OnHTMLViaStringTemplates</url></story><parent_chain><item><author>idlewords</author><text>Another reason you won&amp;#x27;t find people using string templates to produce HTML in Lisp is that no one uses it for web development. This phenomenon where multiple language features conspire to prevent misuse is called defense in depth and is one of the great strengths of the language.</text></item><item><author>hajile</author><text>Yet another incident of Greenspun’s Tenth Rule.&lt;p&gt;Lisp macros make adding HTML syntax easy. You won’t find anyone using string templates in that language because a handful of macros means you can just program like it’s just lisp.&lt;p&gt;Strings such primarily because they don’t establish regularity. If you don’t understand everything fully and follow their patterns exactly, it’s easy to accidentally lose your pseudo-macro hygiene and output garbage.&lt;p&gt;JSX was a revelation simply because it was a “macro” (DSL) that ECMA had already designed an entire spec around (E4X) and thoroughly baked into the language. Like with Lisp, you could just use your normal coding patterns to interface.&lt;p&gt;A custom HTML macro baked into the syntax makes sense in a language where almost everyone using it is going to need HTML. It would make far less sense to dedicate all that syntax space in a more general purpose language.&lt;p&gt;And in JS, even with all that design time spent on E4X, you are still back to doing string interpolation the second you step away from that specific syntax (or you’re forced to express everything as HTML even if it’s not a good fit).&lt;p&gt;The world would be a better place if JS had been scheme and people had been forced to learn a lisp.</text></item></parent_chain><comment><author>AnonymousPlanet</author><text>Historically, web development is among the most noteworthy uses of Lisp in business. Reddit and PG&amp;#x27;s work come to mind.</text></comment>