On Jun 25, 2009, at 1:59 PM, Berlin Brown wrote:
> But does anyone have a problem with Lisp/S-Expressions to HTML/XHtml,
> especially for the entire document.  What is wrong with using some
> form of templating system.  I think that is what Lisp has (see Lisp's
> Html-template).

http://weitz.de/html-template/

Of course, it's made by the same guy as CL-WHO, which uses the s-expr  
system instead:

http://weitz.de/cl-who/

> I am not talking about this particular application, but just in
> general.  I love the ability to take sections of HTML or snippets of
> HTML and use that as the View and then break that off from the
> application code.
>
> But that is just me.

Mixed bag for me, though I pretty much agree. On the one hand, I  
prefer the terseness of s-exp templating, and that you can't forget to  
close a tag. On the other hand, my business partner isn't going to  
learn Lisp anytime soon and needs to be able to modify the HTML that  
gets output. I know technically Lisp is simpler than XML, but it's  
still intimidating to the muggles. :)

The strength of something like PHP or embedded Ruby is that the text  
editors support it and you get the full power of the language inside  
the template. HTML-Template doesn't give you the full power of Lisp  
inside the template, but the advantage is that templates get compiled  
into something that executes really fast and it's easy enough that  
designers can probably handle it.

I kind of hate seeing HTML being manually printed out deep inside the  
code. I'd rather pass s-exps out, or something. Better not to do any  
formatting deep in the code and have a real separation of concerns.  
It's also nice if you can change the way it renders without  
recompiling. HTML-Template, when you load a file, it keeps track of  
that file and if it changes out from underneath it, it notices and  
recompiles the template (rather like JSP, I guess). CL-WHO, you'd have  
to recompile the function somehow, which means you need to have a REPL  
open somewhere you can get to. Which probably isn't impossible but  
seems to be a little more involved with Clojure than it is with Lisp.  
Another point for external HTML-style templates.

I've seen a couple templating systems (notably ZPT/TAL and Kid) that  
work by putting some XML from a different namespace into your  
document. Pro, your XML is always valid; con, it's a pain to work with  
and sometimes you just want to dump out some crap and don't really  
care if it's valid. Convenience versus correctness. I tend to side  
with convenience on templating.

I dunno. This problem has a lot of solutions and all of them seem to  
involve compromises.

—
Daniel Lyons


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to