1 first class function.
2 trait. 可以有方法的默认实现,可以限定被mixed into的类型,可以在语义上更精确地限定方法参数的类型等。
3 variance. 相比Java Generic中有限的支持,Scala中的variance更加灵活。
4 structural type. 基于反射的语法糖,有的时候会发现它非常便利。
5 implicit parameters and conversions. 双刃剑,小心使用。
6 tail calls.
TBC
2 trait. 可以有方法的默认实现,可以限定被mixed into的类型,可以在语义上更精确地限定方法参数的类型等。
3 variance. 相比Java Generic中有限的支持,Scala中的variance更加灵活。
4 structural type. 基于反射的语法糖,有的时候会发现它非常便利。
5 implicit parameters and conversions. 双刃剑,小心使用。
6 tail calls.
TBC
本文介绍了Scala编程语言中的一些高级特性,包括:1. 函数作为一等公民(first class function),2. 特质(Trait)及其提供的方法默认实现、类型限定等功能,3. 协变和逆变(Variance)的灵活应用,4. 基于反射的结构类型(structural type)带来的便利,5. 显式参数和转换(Implicit parameters and conversions)的使用技巧,6. 尾递归调用(Tail calls)等。
108

被折叠的 条评论
为什么被折叠?



