Created
April 23, 2012 19:03
-
-
Save milessabin/2473113 to your computer and use it in GitHub Desktop.
Default argument values only need to typecheck if they're needed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> implicit val i = 23 | |
i: Int = 23 | |
scala> def foo[T](t : T)(implicit ev : T = "foo") = ev | |
foo: [T](t: T)(implicit ev: T)T | |
scala> foo(0) | |
res6: Int = 23 | |
scala> foo("bar") | |
res7: java.lang.String = foo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment