Kontrakty terminowe nie działają przed zakończeniem programu
Próbowałem odtworzyć przykład na nowej Scali 2.10funkcja futures. Kod, którego użyłem to:
<code>import scala.concurrent.Future import scala.concurrent.future object Test { def main(args: Array[String]) { println("Test print before future") val s = "Hello" val f = future {s + " future!"} f onSuccess {case v => println(v)} println("Test print after future") } } </code>
Zamiast drukowania:
<code>Test print before future Hello future! Test print after future </code>
To po prostu drukuje:
<code>Test print before future Test print after future </code>
Czy wiesz, dlaczego mam to zachowanie? Moja wersja kompilatora scala to 2.10.0-20120507.