Not an issue, just a question
Why not use symbols instead of keywords, to reduce syntax? Hiccup and others also go with keywords. Is it performance or memory footprint?
E.g. (jack-html `(div/id1.c1 (h1 (p ,text))))
In jack we could have use symbols instead of keywords.
There would be almost no difference in the implementation:
- Two small changes in
jack-parse-tag-kwin order not to check for keywords and a match that doesn't take into account the:starting a keyword (seen as a string), - use
symbolpinstead ofkeywordpinjack-html.
I chose keywords over symbols because I find it more readable since
keywords are highlighted and not symbols. This gives you something
similar as in html-mode where tags are highlighted. So this has
nothing to do with performance neither memory footprint.
If we talk about Hiccup (Clojure), you do not have to use keywords. Symbols and strings are also accepted:
user=> (use 'hiccup.core)
nil
user=> (html ['div#id1.c1 ['h1 ['p "text"]]])
"<div class=\"c1\" id=\"id1\"><h1><p>text</p></h1></div>"
user=> (html [:div#id1.c1 [:h1 [:p "text"]]])
"<div class=\"c1\" id=\"id1\"><h1><p>text</p></h1></div>"
user=> (html ["div#id1.c1" ["h1" ["p" "text"]]])
"<div class=\"c1\" id=\"id1\"><h1><p>text</p></h1></div>"
I hope this answer your question.
Thanks for providing the insight, I did not expect the highliting aspect (which makes a lot of sense). Neither did I know one could use symbols in Hiccup.
I have been uncommittedly fantasizing about an "any-lisp anytime" HTML generation strategy that works in elisp, Clojure, CL and Scheme. One could get immediate results within Emacs, and deploy to other lispy languages (bootstrapping and surrounding app logic would be lispy-variant-specific); at development time or runtime, server side or client side (e.g. ClojureScript).
Perhaps that may someday lead to an abstraction where a view is described by its generation template, but the time&place of generation is left as an optimization which decides which bits are SSG, SSR or CSR.