[stringtemplate-interest] Thoughts on StringTemplate

Terence Parr parrt at cs.usfca.edu
Thu Jun 28 15:55:53 PDT 2007


On Jun 1, 2007, at 8:00 PM, John Snyders wrote:

> On my blog I give some ideas for future work on the StringTemplate  
> language.
>
> I would be interested in any feedback either here on the mailing  
> list or
> in comments
> to my blog.
>
> See:
> http://hardlikesoftware.com/weblog/2007/06/01/thoughts-on- 
> stringtemplate-part-1/
>
> I plan to add one or two more posts on the same topic.

Hi John,

Nice stuff.  I really like the way you have laid out the difference  
between maps and objects and so on.  These discrepancies arose from  
the evolutionary nature of string template as I added more and more  
features.   The language needs to be cleaned up and I think I would  
like to add the cardinality information so that we can say whether an  
element has there are more or is optional etc.  As for the shape of  
the object, I like the idea, but then would we not be re-specifying  
the class definition inside the template? Is that not like just  
pointing at the class definition then?  Then we'd be typing the  
arguments.  I guess not, it would be like specifying an interface to  
a subset of the fields.  Hmm...perhaps

test(user.{name,phone,salary}+, title) ::= "..."

indicates that there are one or more users that have three field I  
use and there is a title attribute which must exist.

As you point out so correctly in the second post

http://hardlikesoftware.com/weblog/2007/06/25/thoughts-on- 
stringtemplate-part-2/

the the difference between templates and groups of templates really  
needs to be rethought.  Tom Burns, a co-author of the ST engine, is  
asking me to build a backward-incompatible version that fixes this  
problem.  4.0? As I understand his issues, he wants directories of  
templates and group files to behave identically. Currently, there is  
no template-relative addressing-- all of the templates are absolute  
from the group root even if they don't start with /. The ability to  
have parameter definitions on individual template files is also  
necessary.  I can't remember what syntax I was thinking here.  I  
think this is what you are describing in your post. As you point out,  
a way to referred to templates for multiple groups at once is  
necessary; sort of like a CLASSPATH.

As for the "use"/import idea: I'm not sure this should be done  
statically.  I think a dynamic " here is the list of groups you can  
draw templates from" might be better.  Or, are you saying this is a  
more general version of inheritance?

Ter


More information about the stringtemplate-interest mailing list