[stringtemplate-interest] Clarification of objects-as-attributes

Sam Barnett-Cormack s.barnett-cormack at lancaster.ac.uk
Wed Apr 1 09:50:19 PDT 2009


Hi all,

I wanted to check this out before I went ahead and wrote it, and I seem 
to be feeling a lack of clarity from the docs.

I plan to pass in attributes that are objects, with their properties 
being accessed as sub-attributes (or whatever you'd call them). Like 
having an attribute "member" and passing in an instance of a particular 
class with properties "name" and "docs" accessed as member.name and 
member.docs, docs also having members so getting potentially 
member.docs.head (although actually docs gets passed to another 
template, so it's just docs.head).

I also plan to have member.type, which has a member parameters - and I 
want *parameters* to be multi-valued so I can iterate over it with 
<parameters:type();separator = " , ">

Is this possible? Do I just make member.type.parameters a List<T> or 
array or something?

As a much quicker question, are the namespaces for templates and 
attributes distinct? That is, can I have an attribute type and a rule 
type()? It might sound confusing, and I may change it in any case, but 
my current design leads to <type:type()>.

Thanks for any guidance,

Sam


More information about the stringtemplate-interest mailing list