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

REPL thread management violates principle of least astonishment and is unusable with libraries that use thread-locals #4886

Closed
scabug opened this issue Aug 7, 2011 · 4 comments

Comments

@scabug
Copy link

scabug commented Aug 7, 2011

The Scala 2.9 REPL evaluates each line in its own thread.

This violates the principle of least astonishment, but more importantly, it makes the REPL unusable with the many libraries that rely on thread-local contexts.

For instance, many ORMs use thread-locals for session management. One cannot meaningfully use these ORMs from the REPL as a result.

@scabug
Copy link
Author

scabug commented Aug 7, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4886?orig=1
Reporter: Yang Zhang (yaaang)
Affected Versions: 2.9.0-1

@scabug
Copy link
Author

scabug commented Sep 21, 2011

@paulp said:
-Yrepl-sync in 2.9.1 disables thread creation.

@scabug
Copy link
Author

scabug commented Jul 14, 2012

Christian Schlichtherle (christian_schlichtherle) said:
This just puzzled me, too:

Welcome to Scala version 2.9.2 (Java HotSpot(TM) Client VM, Java 1.7.0_05).
Type in expressions to have them evaluated.
Type :help for more information.

scala> val tl = new ThreadLocal[Int]
tl: java.lang.ThreadLocal[Int] = java.lang.ThreadLocal@3571fd

scala> tl.set(1)

scala> tl.get
res1: Int = 0

@scabug
Copy link
Author

scabug commented Jan 6, 2015

@som-snytt said:
Fair to say this was settled in 2.10, except maybe for the part about being least astonished.

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

No branches or pull requests

1 participant