On Wednesday, July 9, 2014, Dean Wampler <
deanw...@gmail.com> wrote:
Welcome to Scala version 2.11.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_45).
...
scala> def m(implicit i:Int = 0) = println(i)
m: (implicit i: Int)Unit
scala> m()
0
scala> m
0
scala> implicit val iv = 10
iv: Int = 10
scala> m
10
scala> m()
0
This sort of breaks the "principle of least surprise".
Arguably it is in poor style to define implicit params with defaults, but the results aren't that surprising IMO. The implicit argument list is only provided by the compiler if you don't provide it explicitly. Your second example does provide it explicitly, albeit short argument, which is where defaults are triggered.
Jason