Last active
September 10, 2016 08:06
-
-
Save oxbowlakes/a3a580cab76f7109ca055a30b86e950c to your computer and use it in GitHub Desktop.
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 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45). | |
Type in expressions for evaluation. Or try :help. | |
scala> import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.concurrent.ExecutionContext.Implicits.global | |
scala> scala.concurrent.Future( { println("foo"); 4 }) | |
foo | |
res0: scala.concurrent.Future[Int] = Success(4) | |
scala> res0.map(_ + 1) | |
res1: scala.concurrent.Future[Int] = List() //It's a List. Wait. What? | |
scala> res0.map(_ + 1) | |
res2: scala.concurrent.Future[Int] = Success(5) //OK, so it's a Success. Phew | |
scala> res0.map(_ + 1) | |
res3: scala.concurrent.Future[Int] = Success(5) //Thanks goodness! | |
scala> res0.map(_ + 1) | |
res4: scala.concurrent.Future[Int] = List() //It's a List again. What is going on? | |
scala> res0.map(_ + 1) | |
res5: scala.concurrent.Future[Int] = List() //Still a List | |
scala> res0.map(_ + 1) | |
res6: scala.concurrent.Future[Int] = Success(5) //um. Hang on, why *is* it a Success? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, You are right.
but on 2.11.7 It' work fine