2378 review fixes

This commit is contained in:
Viktor Klang 2012-09-21 11:21:55 +02:00
parent 527771d249
commit e414c2a3b7
2 changed files with 4 additions and 8 deletions

View file

@ -6,14 +6,10 @@ package docs.dataflow
import language.postfixOps import language.postfixOps
import scala.concurrent.util.duration._ import scala.concurrent.util.duration._
import scala.concurrent.{ Await, ExecutionContext, Future, Promise } import scala.concurrent.{ Await, Future, Promise }
import org.scalatest.WordSpec import org.scalatest.WordSpec
import org.scalatest.matchers.MustMatchers import org.scalatest.matchers.MustMatchers
import util.{ Try, Failure, Success } import scala.util.{ Try, Failure, Success }
object DataflowDocSpec {
}
class DataflowDocSpec extends WordSpec with MustMatchers { class DataflowDocSpec extends WordSpec with MustMatchers {
@ -23,7 +19,7 @@ class DataflowDocSpec extends WordSpec with MustMatchers {
//#import-global-implicit //#import-global-implicit
import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.ExecutionContext.Implicits.global
//#global-implicit //#import-global-implicit
import DataflowDocSpec._ import DataflowDocSpec._
"demonstrate flow using hello world" in { "demonstrate flow using hello world" in {

View file

@ -11,7 +11,7 @@ The benefit of Dataflow concurrency is that it is deterministic; that means that
If you run it once and it yields output 5 then it will do that **every time**, run it 10 million times - same result. If you run it once and it yields output 5 then it will do that **every time**, run it 10 million times - same result.
If it on the other hand deadlocks the first time you run it, then it will deadlock **every single time** you run it. If it on the other hand deadlocks the first time you run it, then it will deadlock **every single time** you run it.
Also, there is **no difference** between sequential code and concurrent code. These properties makes it very easy to reason about concurrency. Also, there is **no difference** between sequential code and concurrent code. These properties makes it very easy to reason about concurrency.
The limitation is that the code needs to be side-effect free, e.g. deterministic. The limitation is that the code needs to be side-effect free, i.e. deterministic.
You can't use exceptions, time, random etc., but need to treat the part of your program that uses dataflow concurrency as a pure function with input and output. You can't use exceptions, time, random etc., but need to treat the part of your program that uses dataflow concurrency as a pure function with input and output.
The best way to learn how to program with dataflow variables is to read the fantastic book `Concepts, Techniques, and Models of Computer Programming <http://www.info.ucl.ac.be/%7Epvr/book.html>`_. By Peter Van Roy and Seif Haridi. The best way to learn how to program with dataflow variables is to read the fantastic book `Concepts, Techniques, and Models of Computer Programming <http://www.info.ucl.ac.be/%7Epvr/book.html>`_. By Peter Van Roy and Seif Haridi.