Which git repo has REPL codebase?
I guess it is:
scala\src\repl
Yep! The UI (jline interface etc) is at https://github.com/scala/scala/tree/2.13.x/src/repl-frontend/scala/tools/nsc.
If you’re interested, an awesome first project would be to upgrade the repl to JLine 3. Here’s the ammonite PR that does that: https://github.com/lihaoyi/Ammonite/pull/775. Please target 2.13.x. See also https://github.com/scala/scala/pull/5903 for the PR that did an initial cut between UI and internal logic (which we can hopefully simplify along the lines of https://github.com/scala/scala/pull/5220 (not yet finished).
Very happy to help, please @mention me or email me directly (s"[email protected]"
) if I miss a post on this.
Would definitely look into it.
@adriaanm, any specific test to debug ILoop?
The best we have is a bunch of tests that extend ReplTest. I’m afraid none of them are that useful for debugging: they are meant as regression tests.
ILoop is probably one of the trickier parts of the repl… I’m very open to reworking it so that it’s easier to understand. This is why I’ve started carving out an API (very rough at this point), so that we can actually clean this stuff up without breaking sbt/spark/…
I changed from Jline 2 to Jline 3 in my local repo, and there are compilation errors all over.
Would try to fix them this weekend.
What is root in following import in JLineHistory.scala:
import _root_jline.{console => jconsole}
I get error:
object jline is not a member of package root
_root_
is used when something in the local namespace would cause something to be misinterpreted, and tells the compiler that something is definitely a root package, not a local identifier. so for example:
scala> def foo: java.lang.Integer = 0
foo: Integer
scala> val java = 3
java: Int = 3
scala> def foo: java.lang.Integer = 0
<console>:12: error: value lang is not a member of Int
def foo: java.lang.Integer = 0
^
scala> def foo: _root_.java.lang.Integer = 0
foo: Integer
as for JLine in particular, I think I remember reading that in JLine 3, they moved all the code from jline
to org.jline
? Maybe that’s what you’re seeing.
That’s correct. Additionally it looks to me like what was previously in “jline.console” is now in “org.jline.reader”.