News for hackers. Stuff that matters.
Re:Having a Go - first time experience with Golang by pcwalton on Monday July 09, 2012 @03:00PM (#4219796)
Type parameters are invariant, unless explicitly specified to be covariant with a where clause.
Re:Having a Go - first time experience with Golang by Peaker on Monday July 09, 2012 @03:06PM (#4219821)
Well, if List<T> is invariant on the T, then you cannot usefully have lists parameterized on interfaces, which is losing a useful ability. I'd say that classifies as a thorny edge case.

In Haskell, I can represent the type:

  (Show a, Ord a) => [a]
It seems like the same is impossible in C# due to generics' interaction with inheritance.