[stringtemplate-interest] ST4 inheritance without a group header?
Terence Parr
parrt at cs.usfca.edu
Tue Feb 23 16:37:32 PST 2010
On Feb 23, 2010, at 1:07 PM, Gerald Rosenberg wrote:
> On 2/23/2010 10:48 AM, Terence Parr wrote:
>>> Are you aware of any other languages with
>>> this type of dynamic inheritance?
>>>
>> no doubt Ruby and Python can do that ;)
>>
>
> Don't Ruby and Python use source statements to specify the import.
well,For both import and superclass they do, but I'm under the impression you can monkey with the inheritance at runtime.
> Thus, the import statement is in the file being parsed. No problem then
> for static analysis to actually trace it.
>
> For ST4, the import statement is in the controller's glue and invisible
> to any parse of a template.
yup :(
>>> 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.
>>>
>> Interesting. perhaps making the group header optional...or introduce an option?
>
> You mean a grammar file option?
nope. something inside the stg file:
options {super="another.stg"}
foo() ::= "..."
>> It still brings up the question of how do you know where the supergroup lives on the disk.
>>
> Not sure the problem. You already impose a directory structure - could
> just pass the template root path as a parameter to STGroupFile and
> STGroupDir and support relative paths in the templates, right?
well, I was able to rip out all of that STGroupLoader crap from v3 because I didn't have to allow people to give me some kind of a classpath=like mechanism defined supergroups. the supergroup could be from a socket a database another directory etc.
T
More information about the stringtemplate-interest
mailing list