Monday, November 12, 2007

Generalizing C# Generics

In previous posts, I had commented on certain non-sensical limitations in the C# type system, particularly with regard to equational constraints on generic type parameters; these unfortunate limitations significantly reduce the expressiveness of well-typed solutions.

Microsoft Research had actually already tackled the problem in their 2006 paper Variance and Generalized Constraints for C# Generics. Taking inspiration from Scala, they generalize class and method parameter constraints with arbitrary subtyping relations, and they further add use-constraints on generic methods. This increased expressiveness should address the problems I alluded to in my previous posts; if only the changes were integrated into the .NET VM and C#... :-)

[Edit: figures that LTU already covered this paper]

No comments: