[stringtemplate-interest] v4 ST

Zenaan Harkness zen at freedbms.net
Thu Oct 8 16:02:13 PDT 2009


On Thu, Oct 08, 2009 at 11:23:04AM -0700, Bill Venners wrote:
> 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():

Here's a thought to counter the 'java.util.Map has .push()' position:

Map exists in a context. The context of Map is containers/ vectors.

In the context of Java containers, the contract of each container type,
eg List, Deque and ConcurrentNavigableMap, must be distinguished, and is
distinguished in the documentation, but more importantly, there must be
different method names for contractually different operations.

And in Java, we see the unfortunate overloading of java.awt.Container
and java.util.Container. Everything's easy in hindsight of course :/

It is of course desirable to align as closely as possible to
"traditional" java apis, such as Map.

However, given that:
   -  ST is not actually implementing Map interface
   -  there are other container types using .add
      -  which containers have an adequate "contractual similarity"
         to the ST 'container'
   -  and there being still significant differences and intents
      between Map and ST (such as it's more 'post' and 'read'
      than push/pull/pop, if we are to be as semantically precise
      as possible),

I submit that .add is not only adequate, but ideally compromised (hmm,
that didn't quite come out right :), or shall we say then, supremely
adequate. Ahh, I might just give up at this point... I have little hole
here somewhere that I jump into occasionally... 


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

:)

-- 
Homepage: www.SoulSound.net -- Free Australia: www.UPMART.org
Please respect the confidentiality of this email as sensibly warranted.


More information about the stringtemplate-interest mailing list