I'm reading about Futures and Promises in Scala and wrote the following code:
def printSomething(): Future[String] = {
  val p = Promise[String]
  val sayHello = future {
    Thread.sleep(1000)
    p.success("hello")
  }
  p.future
}
def main(args: Array[String]) {
  val something: Future[String] = printSomething()
  something onComplete {
    case Success(p) => println(p)
  }
}
The problem is the onComplete callback doesn't print anything (unless I debug it).
Wouldn't the onComplete have to wait for the p.success("hello") in the printSomething ?
 
     
     
     
     
    