[stringtemplate-interest] ST4 inheritance without a group header?

Gerald Rosenberg gerald at certiv.net
Tue Feb 23 09:00:00 PST 2010


On 2/21/2010 8:42 AM, Terence Parr wrote:
>
> crap. i'm pretty sure i have unit tests...anything obvious in there?
> oh sorry! found it:
>
>       /** Make this group import templates/dictionaries from g. */
>       public void importTemplates(STGroup g) {}
>
> I renamed it to import rather inheritance; easier concept.
>    

OK, works as intended.  Nice!

Dropping the group statement creates an interesting conundrum.  Since 
STv3 and v4 both use .stg files, no way for a tool to know whether to 
mark existence or absence of the group statement as an error.

Perhaps more significant, static analysis of ST4 template files becomes 
problematic since there is no way to automatically evaluate inheritance 
- no way for a tool to know what the chain of dynamic imports will be 
for a particular template.  Are you aware of any other languages with 
this type of dynamic inheritance?  Would be interesting to see how their 
tools handle the issue.

Wonder if makes sense to require, or at least allow, an ST4 template to 
statically inherit an .sti interface?  Cannot make this change just in 
the tool - the templates would not be portable.



More information about the stringtemplate-interest mailing list