[racket] comments requested from users of SXML and PLT xexprs

From: Noel Welsh (noelwelsh at gmail.com)
Date: Thu Dec 23 02:24:35 EST 2010

On Tue, Dec 21, 2010 at 2:20 PM, Neil Van Dyke <neil at neilvandyke.org> wrote:
>
> Here's a simple example, which doesn't demonstrate all the features:
>
>   (html-template
>     (html (head (title "Foo & Bar"))
>           (body (h1 (*value* essay-title))
>                 (p "Bunnies are nice." (br) "Yep."))))
>
...

Looking forward to seeing it (and the other libraries).

We've been using Scala / Lift a bit recently, and it has an
interesting approach to templating. For a start all template
processing functions are NodeSeq -> NodeSeq, which is the Scala
equivalent of List -> List. I.e. they get around the splicing problem
by requiring you to always return an HTML element such as a span or
div. Some may find this aesthetically displeasing but it is minor and
makes the system simpler. I recommend the same; trying to keep things
straight otherwise (particularly without a type system) is too hard.

Lift templates contain no code, but rather specify the points, using
conventions in the markup, where the template processor (called a
snippet) should insert values. It is up to the snippet to, say, loop
over some set of values and so on It is a bit an inversion of the
usual template system, where we think of the template as a function
from some values to XML.

There is a bit more here:

http://simply.liftweb.net/index-Chapter-6.html#toc-Section-6.1

http://simply.liftweb.net/index-6.9.html#toc-Section-6.10

Lift templates are not 100% awesome (for example, the contract they
define is completely implicit) but I think they work better than
having for-each / map etc. in templates.

HTH,
N.


Posted on the users mailing list.