-
Notifications
You must be signed in to change notification settings - Fork 30
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
parallel operations never terminate in the REPL #34
Comments
This is a consequence of the new lambda encoding:
However, that its own problems, so we can't make it the default. For the 2.13 REPL, we're aiming for a best-of-both-worlds solution. |
Another workaround:
|
@retronym this is not inherent to the Java8 lambda encoding. This is simply a bug due to way how labmdalift works in Scalac. Dotty compiled code does use lambdas but does not have issue with the deadlock in static initializer. Similar discussion happened here: typelevel/scalacheck#290 |
@DarkDimius The PR you linked doesn't describe the change in enough detail for me to understand. I've produced a bytecode diff to contrast scalac and dotty for this test case. Could you help connect the dots for me? |
Okay, now I see the difference. The lambda in scalac is backed by a static method, and in dotty it is backed by an instance method for a lambda that captures |
I believe the criterion is which this-references the lambda contains. If it contains references to an enclosing this, it goes in the same class. if it does not contain any this references, it becomes static. |
There's one additional rule: it becomes static unless it's owned by a top-level module class. |
Tested with scala 2.13.0-M1 and parallel-collections 0.1.2.
The following expression does not terminate in the REPL:
With 2.11.8 it terminates. With 2.12.3 it doesn’t terminate either.
However, if I put the same expression in a program its evaluation does terminate.
The text was updated successfully, but these errors were encountered: