[IETF Apps meeting] A Theory of Templating Languages

The IETF (http://www.ietf.org/) holds a meeting of its Application Area and is looking for papers. In a position paper, Joe Gregorio asked for information about the theory of templating languages. Giving the interest here in DSLs and conceptualization, he may find on this list the help he wants and the references he searches:
From: "Joe Gregorio"
Date: December 14, 2007 8:20:17 AM PST Subject: Re: Position papers due Dec 14 Here is my brief position paper:
Working on the URI Templating specification has made me realize that there is a pretty substantial hole in computer science theory: a lack of a theory of templating languages. For example, the current version of URI Templates is not Turing-complete, which excludes a whole bunch of possible attacks. In the specification I state:
On the balance, the template processing is not Turing complete, thus avoiding a number of security issues, ala the billion-laughs attack of XML DTDs.
I was rightly called out on this on the W3C URI mailing list:
This reads a little odd, as not being Turing-complete is not sufficient to avoid the attack. (And DTDs are not Turing-complete either.)
The criticism is correct. The problem is that I don't know of any finer grained levels of classifications of templating languages than Turing/non-Turing, and not only for security reasons, but for general capabilities.
For example, if there were classes of templating languages, I could say that URI Templates fell into 'class X', and if that class had a known set of limitations and capabilities then I could say that URI Templates thus had those limitations and capabilities. The weakness to the billion laughs attack comes from two facets of DTD usage, the first being that templates can be defined in terms of other templates, and the second is that the depth of template definition, in terms of other templates, isn't limited. But the converse isn't true, that is, I don't have a general theory of templating to lean on that says since URI Template expansions are never defined in terms of other expansions then URI Templates are immune to such resource exhaustion attacks.
I did find one paper that makes a start at such work, "Enforcing Strict Model-View Separation in Template Engines", but the theory is a little weak and it focuses on the nebulous idea of separation of model and view, as opposed to a classification of capabilities and limitations. In addition there seems to not be a lot of work on sub-turing languages, and most interestingly the contemporary work that is being done is on Membrane Computing Systems, which is in turn motivated by studying cell evolutions and chemical reactions. I am bringing this topic forward in the hopes of learning of other pointers into the literature, and also learning if this problem applies to others in the Apps area, of if I'm all alone with this problem in URI Templates.
----- End forwarded message -----

I did find one paper that makes a start at such work, "Enforcing Strict Model-View Separation in Template Engines", but the theory is a little weak and it focuses on the nebulous idea of separation of model and view, as opposed to a classification of capabilities and limitations.
When I did the research for my template engine paper, that was also the most theoretically-inclined paper I could find. In fact, it was almost the only paper focusing on template languages. That entire area, of considerable importance in practice, seems to be completely ignored by computer science. My own work was more on the practical side, but its first section may be of some interest for its (sadly informal) pointing out of relationships between template engines and functional programming. The paper and the slides can be found at: http://www.idealliance.org/papers/extreme/proceedings/html/2007/Blazevic01/E... Good luck. -- Mario Blazevic mblazevic@stilo.com Stilo Corporation This message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure, copying, or distribution is strictly prohibited. If you are not the intended recipient(s) please contact the sender by reply email and destroy all copies of the original message and any attachments.
participants (2)
-
Mario Blazevic
-
Stephane Bortzmeyer