Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limitation is not in README #2

Open
hiroshi-cl opened this issue Nov 16, 2021 · 1 comment
Open

Limitation is not in README #2

hiroshi-cl opened this issue Nov 16, 2021 · 1 comment

Comments

@hiroshi-cl
Copy link

Thank you for your smart and interesting implementation, which uses context abstraction, Project Loom's coroutines and no CPS transformation.

However, there is a point which concerns me.
Some type of monads, such as list monad, does not work well, since a coroutine can simulate only an "affine" delimited continuation, which can be used at most once.

An example using Scalaz follows:

    val list: List[Int] = reify [List] in {
      val l = List(1, 2, 3).flatMap(x => List(x + 5)).reflect
      val k = List(2, 3, 4).reflect
      l * k
    }

    println(list)
[error] (run-main-0) java.lang.IllegalStateException: Continuation terminated
[error] java.lang.IllegalStateException: Continuation terminated
[error] 	at java.base/java.lang.Continuation.run(Continuation.java:286)
[error] 	at monadic.Coroutine.resume(Coroutine.scala:19)
[error] 	at monadic.Monadic.step$1(Monadic.scala:49)
[error] 	at monadic.Monadic.run$2$$anonfun$1(Monadic.scala:61)
[error] 	at monadic.ScalazMonadic.sequence$$anonfun$2$$anonfun$1(examples.scala:14)
...

Would you write this limitation in README?
Thank you.

@b-studios
Copy link
Contributor

Yes, good point. Loom is one-shot only, so that is the best we can do at the moment, sadly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants