[stringtemplate-interest] static typing

Terence Parr parrt at cs.usfca.edu
Fri Jun 19 17:44:03 PDT 2009


On Jun 18, 2009, at 1:40 PM, Graham Wideman wrote:

> Hi Ter:
>
> Some comments:
>
> 1. You would be introducing an additional tool and step into the  
> mix: A step in which templates get processed at development time,  
> and other artifacts are produced (so far consisting of a proxy class  
> for each template).  If you're going down that path -- ie:  
> development-time munching on the templates -- do you also have in  
> mind other processing that could happen then?

I'm open to anything at this point since I'm in the design phase for  
the new tool :)

> For example, are you considering checking arg types where one  
> template invokes another? Or for that matter, percollating arg types  
> from an invoked templates that declares types, up to an invoker  
> template that does not?

Often I don't know what that template is; especially in the case of  
template polymorphism. I really do want to get better at errors for  
the programmer though.

> Also, will there need to be more conventions around how the dev-time  
> template muncher finds STGs vs how the user's actual app finds STGs?

I'm leaning back towards building a hyperfast interpreter instead of  
code generation.

> 2. I'm guessing that if args are declared in ancestor groups or in  
> interfaces (STIs) that descendants/implementers either must declare  
> same-type args, or perhaps are free to not declare arg types, and  
> just inherit the arg types?

hmm...i guess this is probably moot as I'm now flipping back to not  
doing static typing.

> 3. Are you considering some runtime checking that the proxy classes  
> are in sync with the actual STG file's template args? Ie: so that a  
> warning gets generated on loading the STG, rather than waiting for  
> failure on actually setting the attribs on the specific template, or  
> just wrong template output? (Or is the idea to cover this by unit  
> tests for all templates?)

presumably we would do checking on-demand when you invoke the  
template. ST interfaces check the whole thing now when you load group  
I believe.

> 4. If you're adding types to args, might there also be utility to  
> declaring whether an arg value is required to be set? Sort of like  
> "NOT NULL", except there might be some need to distinguish "the  
> calling program didn't set this attribute" vs "the calling program  
> explicitly set this to empty string" etc.

Yep, I was going to use ?, +, and * :)

Ter


More information about the stringtemplate-interest mailing list