diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-12-02 17:10:35 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-12-13 17:36:16 -0800 |
commit | 858a5d513779f4af6f12c0a530bdeceb7a7fd4d9 (patch) | |
tree | becda6df1363a92c1fcdf39643433ba101de4c10 /test/pending/continuations-pos/t3620.scala | |
parent | 7e74aa6b134bcaf158bd51aa7a63a4aaa8fee62e (diff) | |
download | scala-858a5d513779f4af6f12c0a530bdeceb7a7fd4d9.tar.gz scala-858a5d513779f4af6f12c0a530bdeceb7a7fd4d9.tar.bz2 scala-858a5d513779f4af6f12c0a530bdeceb7a7fd4d9.zip |
Modularize continuations plugin.
The continuations plugin and library will still ship with 2.11 (albeit unsupported).
They now reside at https://github.com/scala/scala-continuations.
Diffstat (limited to 'test/pending/continuations-pos/t3620.scala')
-rw-r--r-- | test/pending/continuations-pos/t3620.scala | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/test/pending/continuations-pos/t3620.scala b/test/pending/continuations-pos/t3620.scala deleted file mode 100644 index 8496ae2858..0000000000 --- a/test/pending/continuations-pos/t3620.scala +++ /dev/null @@ -1,73 +0,0 @@ -import scala.collection.mutable.HashMap -import scala.util.continuations._ - -object Test extends Application { - - class Store[K,V] { - - trait Waiting { - def key: K - def inform(value: V): Unit - } - - private val map = new HashMap[K, V] - private var waiting: List[Waiting] = Nil - - def waitFor(k: K, f: (V => Unit)) { - map.get(k) match { - case Some(v) => f(v) - case None => { - val w = new Waiting { - def key = k - def inform(v: V) = f(v) - } - waiting = w :: waiting - } - } - } - - - def add(key: K, value: V) { - map(key) = value - val p = waiting.partition(_.key == key) - waiting = p._2 - p._1.foreach(_.inform(value)) - } - - def required(key: K) = { - shift { - c: (V => Unit) => { - waitFor(key, c) - } - } - } - - def option(key: Option[K]) = { - shift { - c: (Option[V] => Unit) => { - key match { - case Some(key) => waitFor(key, (v: V) => c(Some(v))) - case None => c(None) - } - - } - } - } - - } - - val store = new Store[String, Int] - - def test(p: Option[String]): Unit = { - reset { - // uncommenting the following two lines makes the compiler happy! -// val o = store.option(p) -// println(o) - val i = store.option(p).getOrElse(1) - println(i) - } - } - - test(Some("a")) - -} |