Scala is famous in part for having one of the richest type systems of all mainstream programming languages today. Despite its reputation, Scala’s type system remains one of the most under-documented and jargon-heavy aspects of Scala.
This talk will turn the academese into English, providing an example-rich tour of Scala’s type system, covering all the things that make people call it “powerful”. This talk isn’t about showcasing a bunch of challenging little logical puzzles with types; on the contrary, this talk is about showing practical uses of Scala’s type system, making it work for you and your users. We’ll see how we can use it to improve usability by reducing boilerplate, meanwhile keeping code type-safe. We’ll touch on the practical parts of Scala’s type system, all through examples.
Big thanks to:
Julien Richard-Foy, who provided a great co/contravariance example
http://julien.richard-foy.fr/blog/2013/02/21/be-friend-with-covariance-and-contravariance/
Rex Kerr and mucaho for a variance vs bounds SO example http://stackoverflow.com/questions/4531455/whats-the-difference-between-ab-and-b-in-scala
Bill Venners, for his explorations with type parameters vs type members http://www.artima.com/weblogs/viewpost.jsp?thread=270195
And David R. MacIver for a great running existentials example
http://www.drmaciver.com/2008/03/existential-types-in-scala/