> It uses eval at runtime, but only once: that code slurps a template, turns it > into s-expressions, then uses eval to define a function named `render` in the > appropriate namespace. Pretty nice.
Awesome, yes that'll do then. Good to know this is possible in Clojure. I much prefer this style of templating to Enlive, because it makes it far easier to work with (IMO), and I wouldn't be surprised if it is faster too. Thanks, - Greg On Feb 4, 2010, at 8:46 PM, Richard Newman wrote: >> And he does have some eval's in there: >> >> http://github.com/brool/gulliver/blob/master/template-servlet.clj >> >> But my Clojure knowledge isn't yet good enough to tell me whether he's using >> eval only once or on every render? > > It uses eval at runtime, but only once: that code slurps a template, turns it > into s-expressions, then uses eval to define a function named `render` in the > appropriate namespace. Pretty nice. > > That function is just like one defined in Clojure source: it'll get JITed, > for example. > > One might avoid the (minor) runtime work by "precompiling" templates: > translating them into the equivalent Clojure source on disk, which can then > be treated like ordinary source files. That's what Cheetah does for Python. > > -- > 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 -- 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