Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
最近对 Scala master 的一项提交删除了对将上下文/视图边界与隐式参数结合起来的限制。这是一个很大的改进,减少了样板的数量,但是之前做出这种限制的原因是什么,我们现在可以期待什么后果?
上下文和视图边界添加隐式参数。所以如果你写:
def f[T : Manifest](l: List[T])(implicit ord: Ordering[T])
事实上,有两个隐式参数被传递而不是一个。允许这种语法肯定会导致一些混乱。随着隐式参数的使用开始变得更加普遍,由于类型类,能够执行上述操作会很有帮助。