Generics and Wildcards

Martin write a post entitled Generics: The Importance of Wildcards

He concludes with:

Unfortunately, C# will not support wildcards or a similar mechanism. The implementation strategy does not allow the introduction of wildcards (generics are implemented in the runtime instead of by type erasure). This is a bit surprising, since the implementation strategy is often claimed to be superior. What disappoints me is that the designers of C# are not willing to admit that subtyping is an issue and that wildcards are a solution.

That's a very binary statement, when in fact the implementation of generics both in the .NET and Java worlds are exercises in tradeoffs.

I agree that subtyping is an issue, and that wildcards are *a* solution (I don't know enough to know whether it is the only solution, or whether a solution that worked only on reference types would be interesting.). But, having looked at the implementation of wildcards in Java, they add a fair amount of complexity to the language, and I'm not sure that the added flexibility that they give you is important enough to add language complexity. I do know that when I was talking to C# users, the ability to do this was not one of the things that came up.

When I weigh the speculative benefits there against the known benefits of the .NET implementation - collections of primitive types, for example - it's pretty clear which one I would prefer.