top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What are the major differences between Future and Promises in Scala?

+2 votes
446 views
What are the major differences between Future and Promises in Scala?
posted Jul 21, 2016 by Karthick.c

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

In Scala 2.10, which includes the relevant part of Akka in the standard distribution, a Future is essentially a read-only reference to a yet-to-be-computed value. A Promise is a pretty much the same except that you can write to it as well. In other words, you can read from both Futures and Promises, but you can only write to Promises. You can get the Future associated with a Promise by calling the future method on it, but conversion in the other direction is not possible (because it would be nonsensical).

answer Sep 9, 2016 by Dominic
...