Created
May 15, 2010 08:58
-
-
Save kmizu/402104 to your computer and use it in GitHub Desktop.
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
object ImplicitRunnable { | |
//こっちのバージョンはまぎらわしいかも | |
//implicit def any2Runnable(block: => Any): Runnable = new Runnable { | |
// def run { block } | |
//} | |
implicit def fun2Runnable(block: () => Any): Runnable = new Runnable { | |
def run { block() } | |
} | |
def main(args: Array[String]) { | |
//使用例 | |
new Thread(() => for(i <- 1 to 10) println(i)).start() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment