4 ms·
It's funny how close your example are to S-expressions, just replace the pointy brackets with round parenthesis and move the closing one to the end: (table
by entrox 3y ago
It's funny how close your example are to S-expressions, just replace the pointy brackets with round parenthesis and move the closing one to the end:
(table
(tr
(td one)
(td two)
(td three))
(tr
(td another table)
(td with more stuff)))
- Zambyte 3y agoPlus by moving the closing bracket to the end, it resolves any ambiguity in nesting.
- TylerE 3y agoIt also tosses the baby out, as you're in that horrible area of distinction-without-difference.
- smcl 3y agoI've seen quite a few HTML templating engines that look just like this (in C#, TS and Python)
- em-bee 3y agoi love s-expressions, but they have closing tags, so to me they are precisely not what the parent example shows. i prefer writing html with closing tags because then i can use any xml parser and my editor can jump from opening to closing tag and back.
- taeric 3y agoWell, sorta. XML style syntax already has open and closing marks for the tags. They just additionally have marks for the end of non-attribute children. s-expressions not having that is still a win.
- em-bee 3y agoyes, s-expressions are a win (that's why i love them) but i don't see the xml structure that way. for me the tags themselves are very elaborate opening and closing markers. that's simply how i perceive it. if a closing tag is missing when there should be one, the structure looks broken to me. the example s-expression matches that structure and i perceive it as the same because the first element in any list has a special meaning (in lisp itself it is the function name, while the rest are arguments) to replicate the html5 structure in the top comment without closing tags as s-expressions i would come up with something different: (table (tr) (td) one (td) two (td) three (tr) (td) another table (td) with more stuff)
- taeric 3y agoI think I see your point, but it feels weird to see this form, to me. To your point, I can see the opening tag as ( and the closing as ), but then that would lead to something more like: (table (tr (td one (td two (td three (tr (td ... Which really just highlights how odd it is to see the opening tags without the closing ones. Which probably goes a long way to explaining why I don't like it. :D Probably more natural to have something like: (html table tr td "one" td "two" tr td "...") In this way, you could optionally have the closing tags of /td and such. Still looks very weird to me.
- charlieyu1 3y agoI liked jade/pugjs or other templatong language that allowed similar stuff back then. Sadly they have fallen out of favour.
- Timon3 3y agoI still use Pug with Vue, it has perfect support and it feels just so good to write. Especially combined with Tailwind!
- gloryjulio 3y agoS expressions with colored braces in ides are amazing
- lawn 3y agoMthis is the idea with Pollen, a static site generator implemented in Racket. The markup experience was super nice.