[stringtemplate-interest] v4 ST

Bill Venners bill at artima.com
Thu Oct 8 11:23:04 PDT 2009


Hi Terence,

add() is nice and concise and clear, but put is what is used in
java.util.Map, and that's what people are doing here, mapping a name
to a value. So put might win on those grounds, but either would work.
Also, I'd stay away from transmogrify():

st.transmogrify("name", "parrt")

Bill

On Tue, Oct 6, 2009 at 4:58 PM, Terence Parr <parrt at cs.usfca.edu> wrote:
> Actually
>
> st.add("name, "parrt");
>
> might not be as clear as
>
> st.put("name, "parrt");
>
> but will people think it means "replace" instead of add?  I kind of
> like put
>
> what about
>
> st.attr("name, "parrt");
>
>
> Ter
>
> On Oct 6, 2009, at 4:56 PM, Terence Parr wrote:
>
>>
>> On Oct 6, 2009, at 4:55 PM, Graham Wideman wrote:
>>
>>> Hi Ter,
>>>
>>> At 10/6/2009 04:38 PM, Terence Parr wrote:
>>>> heh, to distinguish between v4 and v3, I'm thinkingof using ST not
>>>> StringTemplate for main class.
>>>
>>> Sounds fine to me, but what happens at v5?  :-)
>>
>> ha! still ST :)
>>
>>>
>>>> Also using inject (or add) instead of setAttribute:
>>>
>>> I think "add" or "addAttribute" is a definite improvement over
>>> "setAttribute".  I think "inject" is a step in a less-clear
>>> direction, because:
>>>
>>> a) It fails to leverage what a user understands "add" to mean from
>>> other common classes.
>>>
>>> b) It suggests that the calling of this method actively causes the
>>> info in the args to be "injected" into the finished template's
>>> output, when actually all it does is make the information accessible
>>> to the template during its later assembly (toString), and might
>>> actually have no ultimate effect if the template doesn't refer to it.
>>
>> excellent arguments. ok, i'll make it add()
>>
>> Thanks
>> Ter
>> _______________________________________________
>> stringtemplate-interest mailing list
>> stringtemplate-interest at antlr.org
>> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
>



-- 
Bill Venners
Artima, Inc.
http://www.artima.com


More information about the stringtemplate-interest mailing list