-
-
Save kmizu/3899178 to your computer and use it in GitHub Desktop.
(implicit conversions + method values) cause strange problem
This file contains hidden or 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
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1. | |
7.0_03). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> import scala.collection.immutable.StringLike | |
import scala.collection.immutable.StringLike | |
scala> "a".format(_) | |
res0: Any* => String = <function1> | |
scala> "a".format(_: String) | |
res1: String => String = <function1> | |
scala> "a".format(_: String, _: String) | |
res2: (String, String) => String = <function2> | |
scala> "a".format(_: String, _: String, _: Int) | |
res3: (String, String, Int) => String = <function3> | |
scala> "a".format _ | |
<console>:9: error: missing arguments for method format in trait StringLike; | |
follow this method with `_' if you want to treat it as a partially applied function | |
"a".format _ | |
^ | |
scala> ("a":StringLike[String]).format _ | |
res5: Any* => String = <function1> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
implicit conversion が関係あるみたいですねえ