Hacker News new | ask | show | jobs
by WalterGR 2001 days ago
Just curious. I went and skimmed through the handlebarsjs link. I'm used to cl-who and can not see what the js lib does have that is not possible or harder in cl-who.

They are very different styles, though. With cl-who you write code that mimics the structure of HTML and that code outputs HTML. With Handlebars etc. you write your HTML in HTML and embed code in it. Some prefer one over the other.

1 comments

I wrote a templating library that was used for a Slack close we developed a number of years back.

It parses the HTML with embedded code, and generates a Lisp function which is compiled on the fly thanks to Lisp giving runtime access to the compiler. Whenever the source file is changed, the code is regenerated and compiled.

Other languages do the same, but in those cases they have to generate source code and call the compiler as an external program, and then load the generated code into the running program using dynamic linking. The Lisp approach is much more efficient.

Thanks to the quality of SBCL, the templates execute with native performance, which is something very few other solutions do.

The project is unfortunately not documented, but the code is available here: https://github.com/lokedhs/lofn