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.
在对SIP-13的评论中, Martin Odersky 暗示可以创建具有多个参数的隐式方法。根据我的经验,隐式方法总是只有一个参数,我无法想象如何使用具有多个参数的隐式方法。有人可以给出一些用例和解释吗?
例如,如果您需要函数类型的隐式参数:
implicit def foo(x: Int, y: Int) = y * x def bar(x: Int, y: Int)(implicit f: (Int, Int) => Int) = f(x,y) scala> bar(3,4) res3: Int = 12