“I’ve chosen this image of a human brain [on the first slide], to be my metaphor for type inference, because it’s very much a black box. Nobody really, certainly I, knows how it works, but I’m going to try and explain a bit about it,” begins Jon Pretty in the preamble to his talk for NE Scala, in equal parts jest and sincerity.
It’s a tricky topic. Jon covers the core ideas, shows what works, what’s doesn’t work and why. He provides some “simple explanations of covariance and contravariance, […] the differences between type parameters and type members, then show[s] how you can exploit type inference with some good design and applied cunning.” Overall, Jon shows us a lot of code and demos a lot of examples.