[stringtemplate-interest] static typing
Terence Parr
parrt at cs.usfca.edu
Thu Jun 18 11:29:46 PDT 2009
Howdy. One of the things I would like to consider for the next version
of ST is static type checking. Easy way to do that is to generate Java
code from the templates and then let the compiler figure it out. If I
want to keep the system interpreted, though, we need to be more
clever. We could keep the interpreted nature but generate some proxies
that provided setter methods. For example,
THIS:
group T;
foo(int a, String b) ::= "..."
BECOMES
package T;
class foo extends StringTemplate {
public void setA(int a) { setAttribute("a", a); }
public void setB(String b) { setAttribute("b", b); }
}
Then, you could use it like this:
T.foo t = new T.foo();
t.setA(34);
t.setB("hi");
Any thoughts? The types would be optional I think.
Ter
More information about the stringtemplate-interest
mailing list