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
Improve the symbol importers API #7926
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7926?orig=1 |
@retronym said: |
@dotta said: The other question is whether the current implementation of the symbol importers API could be improved to avoid the need of pre-initializing symbols before importing them in a different universe. I don't have enough insights to answer this, but I can imagine doing so may require foundamental changes in the compiler hearth, if possible at all. But the current design seems broken, and fragile. Can you really ensure that you will have initialized enough symbols? |
@retronym said: class Global(expectedThread: Thread) {
def checkThread() { Thread.currentThread == expectedThread }
def set(a: Any) = {checkThread(); ... }
lazy val get = {checkThread(); ... }
}
def importer(g1: Global, g2: Global) = {
g2.set(g1.get)
}
val g1 = new Global(thread1); val g2 = new Global(thread2)
onThread(thread2) {
import(g1, g2)
} Here, onThread(thread1) { g1.get }
onThread(thread2) { importer(g1, g2) } In practice, there are a few more layers; You get Symbols out of Global, and some methods on the Symbol are lazy and need forcing. Brainstorming solutions, we could:
Let's chat about this tomorrow in person. |
@xeno-by said: |
@retronym said: |
Quoting Iulian:
Just for your own curiosity, this is how our code using symbol importer look like https://github.com/scala-ide/scala-search/pull/73/files
Which shows in code exactly what Iulian described. It feels too brittle to be right.
The text was updated successfully, but these errors were encountered: