
上QQ阅读APP看书,第一时间看更新
Understanding types
The type of something is a summation of the information the compiler owns about this something. In the most general case, we're talking about the type of a variable; the knowledge of the compiler includes the methods that are available on this variable and the classes that the variable extends. A very convenient feature of Scala is that it tries to use type inference where possible, freeing the developer from the need to define types explicitly.
Let's take a structured look at Scala's type system, starting with a short recap of its basics.