Another tour of Scala

 
 
 
 

Type Specialization

Viewing old version 3600406155ab51181d6592d75d9a36016026a07c; View Current

The Gist

This isn’t covered by the tour.

My Interpretation

Type Specialization is a feature that allows the Scala compiler to create type-specific versions of classes that take type parameters. For example, if you have a collection of type Collection[T], and you specialize T, the compiler will create not just one class, but one for each primitive type as well as for the object type.

This is entirely transparent to the programmer, and essentially is useful for optimizing code that is being slowed down by autoboxing.

For a great overview, watch [this talk|http://days2010.scala-lang.org/node/138/151] from ScalaDays 2010

My Thoughts on This Feature

TBD


Last Updated 07/16/2010 at 01:47:56 PM by davec

blog comments powered by Disqus