phaller / scala-dev

The Scala Programming Language: Virtualized
http://www.scala-lang.org/
2 stars 0 forks source link

Interplay of Futures, Tasks, and Promises #8

Open heathermiller opened 12 years ago

heathermiller commented 12 years ago

In many aspects, this is still in flux, and still up for discussion

Question: What relationship should there be between Futures, Tasks, and Promises, and should we even include all three?

Discussion: We should keep the notion of a Task, and it should remain distinct from Futures or Promises.

A Task should likely inherit from Future because it should include all the same methods as a Future, though it should additionally include a method such as start to kick-off computation.

Someone who has a Future should not be able to influence the execution of the code which produces the result of that Future. A Future should allow read-only access to the result of the asynchronous computation, and thus should likely not have something like a start method, like in a Task.

Promises should either inherit from Futures, or they should be separate. In the case that they are separate, they should include a future method, or something similar, for getting a Future from a Promise.