[stringtemplate-interest] v4 ST
Graham Wideman
gwlist at grahamwideman.com
Tue Oct 6 18:09:19 PDT 2009
At 10/6/2009 05:51 PM, Gerald Rosenberg wrote:
>Have to say that I liked "inject" on first impression. Add, set and
>put all suggest that the data is potentially still accessible, as if
>the template is just a list or map in the model. Inject reflects the
>conceptual separation: once injected, the template has control.
OK, please correct my understanding if it's wrong:
After the call to setAttribute/add/inject, in general the value that the attribute points to *is* still accessible to the caller, *can* still be changed, and is not actually "injected" into the final string until toString is called.
Actually I have to admit I'm unsure when setAttribute uses reference semantics and when it uses copy, but at least sometimes it uses reference, and in any case the values are not composed into the final ST toString output until toString is called, as I understand it.
If that's a correct account, then Gerald's discussion is really an argument against "inject" I think, and in favor of ...
>The term "associate" might be more accurate, but it is weak and
>long.
... which I too mentioned in earlier message, but I agree that it's long and vague.
> The term "attr" is less accurate, as the parameters are
>attribute and value. Tuple?
Actually I think the args are name and value which together get composed into the attribute. Value could be a simple type or a more complex object. So attribute is an object that maps name to value.
-- Graham
More information about the stringtemplate-interest
mailing list