[stringtemplate-interest] Problem with C# dictionaries

Kunle Odutola Kunle_Odutola at hotmail.com
Tue Oct 31 09:10:38 PST 2006


Hi,

> I don't agree with the implementation of this aspect of the string
> template library. I believe the 'it' notation should always refer back to
> the original object and not some deviation of the object. In order words,
> I feel the following two templates should always render the same output?
>
> $value.something$
>
> $value:{$it.something$}$

They *mean* different things (and in keeping with that, they will render the
same output iff[*] $value$ is assigned to a single-valued attribute). Can't
agree that they should always render the same output.

> In my opinion, this implementation contradicts the philosophy of string
> template. That is, complexity and obfuscation are introduced into the
> string template library for no apparent reason.

I disagree. ST current behaviour regarding $it$ is a nice mechanism that
supports template application to single- and multi-valued attributes
transparently.

Perhaps the new .keys and .values attributes for working with dictionaries
are what you are looking for?

e.g. $aDictionary.keys:{k| $k$ maps to $aDictionary.(k)$ }$


Kunle


[*]    if and only if



More information about the stringtemplate-interest mailing list