[stringtemplate-interest] Subdirectory access in v4
Terence Parr
parrt at cs.usfca.edu
Tue Jun 14 16:17:01 PDT 2011
Hi, Looks like I kind of messed so directory access. Currently everything has to be fully qualified. If you don't put "/" on the front like /templates/mainlook-n-feel/homepage.st it automatically puts one on the front for you.
Originally, talking with Tom Burns (a co-designer of ST), we wanted template references to the relative to the current location. But somehow I remember we found some kind of ambiguity or difficulty and so I backed off to what it was in version 3: fully qualified template names.
I'm nervous about updating given that v4 has been in the wild for five months, but I'm also concerned with the subdirectory thing not working correctly. Tom just suggested a good compromise:
* unqualified template references like <homepage()> would look in the current group
* qualify template references must be fully qualified from the root and start with "/"
I look at a few examples and I think it's hosed. Imagine the following directory structure
root
b.st is b() ::= "yo"
subdir
a.st is a() ::= "<b()>"
b.st is b() ::= "hi"
If you create STGroupDir("root") and ask for b, you will get "yo". If you ask for "/subdir/b" you will get "hi". However, if you ask for "/subdir/a" you will get "yo" NOT "hi" because it takes everything is fully qualified. "<b()>" will look in the root directory because <b()> does not specify a subdirectory.
ok, that is just wrong.
So, do people agree with the breaking change above in the two bullet points? Fortunately, the documentation doesn't seem to even talk about this so were probably okay to fix it ;)
Udo Borkowski has made some good fixes and updates as well; we should do another point release.
Thanks!
Ter
More information about the stringtemplate-interest
mailing list