[stringtemplate-interest] ST# -questionregardingspecialcasingofIList

Kunle Odutola Kunle_Odutola at hotmail.com
Thu May 25 19:10:41 PDT 2006


Jeremy,

> Re: "other issues e.g. with attributes of type Hashtable/IDictionary for
> instance" - They too are special-cased, though at a higher level of
> priority, so I'm not sure how that presents any more of an issue given
> that they too already implement IList and it isn't a problem at the
> moment.

They don't implement IList and they aren't special cased (not in the IList
sense in any case). They would need to be (along with many others) in an
IEnumerable-implies-multi-valued scenario.

> Re: "Template application is applicable to all attributes." - Yes, it
> is, but has different semantics for those that are (at present) IList,
> does it not?

Nope. It has different semantics for single-valued versus multi-valued
attributes. ILists are considered multi-valued.
Can't imagine that one would a different behaviour from applying a template
to a list of values in any case.

> I have to admit that unless I'm still missing something, the position on
> using IList for multi-valued attributes instead of the most appropriate
> interface, that being IEnumerable, is rather like hiding a pea (in that
> anything that would count against IEnumerable already (and still would)
> count against IList, except that targeting of IEnumerable would allow
> multi-valued handling of objects that aren't IList)

Considering virtually all collections to be multi-valued attributes is a
little too wide ranging methinks. There are far fewer ILists than
IEnumerables so that works for me in ST# currently. Had I used IEnumerable,
Ulf's recent post about issues with ArrayList would have also been about
issues with Hashtables (and practically any other collection type).

I did consider special casing IEnumerator instances instead of lists. That
had greater overheads. And the possibility that the enumeratee [ok, not a
real word;-)] could have been altered externally in the meantime rendering
the enumerator useless.

> By the way, at the end of the day I absolutely love ST#, so do bear in
> mind that all this is just in the interest of curiosity and exploration.
> :)

Understood. ;-)


Kunle


More information about the stringtemplate-interest mailing list