Language Game
July 19, 2007 |
co.mments
Christopher Lenz's point about needing presentation logic is on the money, so why not go a little further: "Why Not Just Allow Python in Templates?"
Fair enough - here are some things to think about:
- Principle of Least Power: Tim Berners Lee explains why sometimes less is more.
- Entanglement Index: Terrance Parr gives an outstanding analysis of the cost of expressiveness in template languages.
- Imagine debugging someone else's cool weekend metaclass page template hack.
- Eventually you'd need Zope-style security checks.: "import sys" - boom.
July 19, 2007 01:16 PM
Comments
Terrence Parr espouses ORM in that paper. I've seen way more ORM sins than Template sins.
Personally I hate the mini-language approach to Templates and much prefer Templates that let me use the full host language.
this made me smile...
"While JSP was not the answer, it did put the idea of a template
into programmers’ minds."
... I'm pretty sure templates were around for some time before JSP.
I'd agree with Christopher Lenz's point. Java/C/C++ and HTML make terrible bedfellows, but that's not to say Python or (dare I say it) Perl couldn't coexist with HTML.
You can include Python in Mako templates, to name just one.
I tend to prefer it because invented template syntaxes are prone to falling into the Turing tar-pit: look upon MediaWiki and despair.
There's an enormous gap between the claims "presentation logic is necessary" and "presentation logic should be in the template". The template can be entirely passive if it is reflected into the controller as a data structure. The controller can then manipulate blocks of output in the template by hiding them, replacing their contents, and/or repeating them. This simple mechanism provides all the power you need, while keeping the presentation logic separate from the template. Small extensions make this system very nice to use.
Post a comment
Trackback Pings
TrackBack URL for this entry:
http://www.dehora.net/mt/mt-tb.cgi/2122