[stringtemplate-interest] Problem with C# dictionaries

brian.kejser at protexis.com brian.kejser at protexis.com
Tue Oct 31 15:29:45 PST 2006


Hi

You provided the following exmaple:

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

Suppose the dictionary contained a key called 'keys', then what happens?
Does the string template library return the value assossiated with the
'keys' key or the array of keys?

Thanks




-----Original Message-----
From: "Kunle Odutola" <Kunle_Odutola at hotmail.com>
Sent: Tue, October 31, 2006 9:10
To: stringtemplate-interest at antlr.org
Subject: Re: [stringtemplate-interest] Problem with C# dictionaries

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

_______________________________________________
stringtemplate-interest mailing list
stringtemplate-interest at antlr.org
http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest




More information about the stringtemplate-interest mailing list