What's New in Scala 2.8: The Architecture of Scala Collections
artima.com
artima.com
"Scala is a general purpose programming language designed to express common programming patterns in a concise, elegant, and type-safe way."
Really? But not expressive enough to write the standard collections library I guess?
[UPDATE]: It gets even more amusing -- I just learned they have a paper on the collections library called "Fighting Bit Rot with Types" where they again make no mention of @uncheckedVariance. I guess mentioning that they had to cheat the type system would have undermined their goal of "focussing on the role that type systems play in keeping software architectures coherent over time."
Otherwise, I found the article very valuable. First, it shows you how to extend the library with your own collections. Second, I learned more about how to use Scala's language features to build an advanced library or abstraction by reading about their architecture. The library provides a good example of how to use interface and implementation traits, how to organize a complex class hierarchy (and when the type system might still get in the way of that hierarchy), and how to use implicit arguments to avoid code duplication, among other things.
For anyone even a little interested in Scala, this article, along with the one explaining the API from a user perspective at http://www.scala-lang.org/docu/files/collections-api/collect..., make for a very interesting read.
For more explanation on why it's needed, here's a good link: http://stackoverflow.com/questions/2454281 ("Since we can't abstract over the variance annotation (yet ;-)) in GenericTraversableTemplate, so that we could have instantiated it to either one depending on the subclass, we have to resort to casting (@uncheckVariance is essentially a kind-cast). ")
Scala mailing lists are open to everyone ;)