4 ms·
> ...an "eslisp-html"-macro that compiles to an HTML-templating function... Here's the gist of it so far ... What do you think? Interesting! Similar to Scheme
by jrapdx3 11y ago
> ...an "eslisp-html"-macro that compiles to an HTML-templating function... Here's the gist of it so far ... What do you think?
Interesting! Similar to Scheme templates:
(let* ((admintype (...))
...
(htm (htdoc
`(html
(head
(meta (@ title "My site")))
(body
(div (@ class "banner")
(img (@ class "logo" src "logo.gif"
title ,(get-curr-url))) ...
Basically it just sets up variables for use in the let* scope, and calling the htdoc procedure that parses the quasiquoted list, returning the prepared html as a string (written to the client-connected socket).
The htdoc proc is surprisingly simple, and I've implemented it in other Lispy languages without much trouble. I'd be real interested to try it in Eslisp once I'm familiar enough with it.
> Property access can be sugared to "this.evaluate" with the eslisp-propertify macro ... Is that what you mean?
Possibly. I need to learn it more thoroughly.
Of course I realize the "(. id1 id2 ...)" form expands to object notation. My comment just reflected that to me the leading dot expression looks "noisy", a bit distracting.
In Scheme, identifiers can contain punctuation like ".", so "this.evaluate" could name a procedure, macro, etc. To my eyes, "(this.evaluate)" is visually easier to parse. In my head, the string "this.evaluate" looks like an atom that expands to the operator this.evaluate(), which I think is what it means.
I'm sure I'll get used to the notation as it is, this is just my immediate impression. However, mildly "sugaring" the representation might make it more accessible, especially to people not already enlightened by and in awe of the magic of s-expr.
Edit: getting the code section to look like code...