Created
September 18, 2011 14:23
-
-
Save xuwei-k/1225117 to your computer and use it in GitHub Desktop.
implicitsコマンド
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
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_26). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> implicit def int2String(i:Int) = i.toString | |
int2String: (i: Int)java.lang.String | |
scala> :implicits | |
No implicits have been imported other than those in Predef. | |
scala> object A{ | |
| implicit def int2String(i:Int) = i.toString | |
| } | |
defined module A | |
scala> :implicits | |
No implicits have been imported other than those in Predef. | |
scala> import A._ | |
import A._ | |
scala> :implicits | |
/* 1 implicit members imported from A */ | |
/* 1 defined in A */ | |
implicit def int2String(i: Int): jl.String |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment