[stringtemplate-interest] Attribute definitions, Group files and Templates.

Zenaan Harkness zen at freedbms.net
Sat Oct 17 01:20:33 PDT 2009


On Fri, Oct 16, 2009 at 11:35:16PM -0700, Jonathan Buhacoff wrote:
> On Oct 12, 2009, at 11:53 PM, Zenaan Harkness wrote:
> > On Tue, Oct 13, 2009 at 03:28:59PM +1030, Barrie Treloar wrote:

> >> The other thread about cleaning up ST made me check Jira for one of
> >> the things I wanted while working with ST.
> >>
> >> I wanted to use a directory for my TemplateGroup instead of a file.
> >> As the size of my templates would make the group file massive and  
> >> unwieldy.

> >> Can anyone see the values of having TemplateGroups as a directory  
> >> then?
> >
> > I rather like the structured Java-like approach:
> >
> >   -  Directories correspond to java 'Packages', or "ST Packages"
> >      ie groups of ST TemplateGroups.
> >   -  Files correspond to classes, ie ST TemplateGroup files.
> >   -  Individual ST templates can be in a single file,
> >      BUT, for uniformity (ala Java), should still be a TemplateGroup.
> >
> >
> >   -  Next, TemplateGroups (just Group perhaps??), have an inheritance
> >      hierarchy ("extends", like Java classes).
> >   -  Multiple inheritance, would help big time for me.
> >      -  I have a "lib" ST group
> >      -  I have a language specific group (eg. Java, C#), sort of
> >         specialized 'lib' groups
> >      -  I have specific lower level/ operational groups which often
> >         need to inherit templates from different parent lines.
> 
> It would be nice if there were an interface for loading the templates  
> in a group, something like loadTemplate: String -> StringTemplate, so  
> that in StringTemplateGroup itself this could be delegated to disk-  
> and classpath- specific implementations, and it would be an easy way  
> to integrate other storage or inheritance schemes.

Ack.


> >   -  Ie, I am using the TemplateGroup to bring sanity to the number  
> > and
> >      structure of templates.
> >   -  Without multiple inheritance, I am required to do some really
> >      hacky temporary file munging, to ensure that all groups I need
> >      ultimately form a single-inheritance hierarchy.
> >
> >   -  A good language (eg. Java, ST), provides facilities to  
> > competantly
> >      manage complexity.
> >   -  Current versions of ST do not provide adequate complexity
> >      management facilities for larger projects.
> >   -  So, whether MultipleInheritance, or something else (eg. "mixin"
> >      pattern is the more robust way than "inheritance" pattern to
> >      componentize, where possible, at least when it comes to
> >      programming languages), another tool within ST for complexity
> >      management is required.
> >
> >   -  It is my belief, that because ST is a declarative generative
> >      language, multiple-inheritance should not pose anywhere near the
> >      fine grained difficulties that we see for example in C++ MI.
> >
> 
> I disagree, I think the problems with multiple inheritance will follow  
> that concept into any situation.
> 
> But if we had a clean interface to implement a template loader for  
> StringTemplateGroup without having to replace all the logic in that  
> class, it  would make it easier for Zenaan to implement his package- 
> based and multiple inheritance loaders, even publish them for other  

Ack. If M-I is delegated to the loader, this puts full responsibility on
the ST end user, to resolve load orders/ "which ST to use if ambiguous"
etc. This is good.


> users who may want that.  In my program, I just need to implement a  
> loader that contains a jdbc loader and a classpath loader and try them  
> in order.


zen


-- 
Homepage: www.SoulSound.net -- Free Australia: www.UPMART.org
Please respect the confidentiality of this email as sensibly warranted.


More information about the stringtemplate-interest mailing list