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

JAR for parallel collections in 2.13.0 does not work in REPL via :require #11622

Open
dbdahl opened this issue Jul 10, 2019 · 1 comment

Comments

Projects
None yet
3 participants
@dbdahl
Copy link

commented Jul 10, 2019

In the Scala 2.13.0 REPL, adding the parallel collections JAR file via ":require" does not work, e.g.,

% scala

Welcome to Scala 2.13.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_201).
Type in expressions for evaluation. Or try :help.

scala> :require scala-parallel-collections_2.13-0.2.0.jar
Added '/home/dahl/tmp/scala-parallel-collections_2.13-0.2.0.jar' to classpath.

scala> import scala.collection.parallel.immutable
^
error: object parallel is not a member of package collection

scala>

It does, however, work when the JAR is added as a command line argument.

% scala -cp scala-parallel-collections_2.13-0.2.0.jar

Welcome to Scala 2.13.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_201).
Type in expressions for evaluation. Or try :help.

scala> import scala.collection.parallel.immutable
import scala.collection.parallel.immutable

scala>

In my context, I am embedding the REPL in my application. The user needs to have the ability to added arbitrary JAR files (e.g., the parallel collections library, as above). I hope here is a good solution for this bug. Thanks!

dbdahl added a commit to dbdahl/rscala that referenced this issue Jul 10, 2019

@som-snytt

This comment has been minimized.

Copy link

commented Jul 10, 2019

As a footnote, file completion doesn't work for require.

Perhaps related phenomenon:

$ scala

     ________ ___   / /  ___
    / __/ __// _ | / /  / _ |
  __\ \/ /__/ __ |/ /__/ __ |
 /____/\___/_/ |_/____/_/ | |
                          |/  version 2.13.0

scala> <foo/>
       ^
       error: To compile XML syntax, the scala.xml package must be on the classpath.
       Please see https://github.com/scala/scala-xml for details.

scala> :require scala-xml_2.13-1.2.0.jar
Added '/home/amarki/snips/scala-xml_2.13-1.2.0.jar' to classpath.

scala> <foo/>
       ^
       error: To compile XML syntax, the scala.xml package must be on the classpath.
       Please see https://github.com/scala/scala-xml for details.

scala> :quit
$ scala

     ________ ___   / /  ___
    / __/ __// _ | / /  / _ |
  __\ \/ /__/ __ |/ /__/ __ |
 /____/\___/_/ |_/____/_/ | |
                          |/  version 2.13.0

scala> :require scala-xml_2.13-1.2.0.jar
Added '/home/amarki/snips/scala-xml_2.13-1.2.0.jar' to classpath.

scala> <foo/>
res0: scala.xml.Elem = <foo/>

Just to confirm:

$ scala -cp scala-parallel-collections_2.13-0.2.0.jar

     ________ ___   / /  ___
    / __/ __// _ | / /  / _ |
  __\ \/ /__/ __ |/ /__/ __ |
 /____/\___/_/ |_/____/_/ | |
                          |/  version 2.13.0

scala> scala.collection.parallel.availableProcessors
res0: Int = 12

scala> :quit
$ scala

     ________ ___   / /  ___
    / __/ __// _ | / /  / _ |
  __\ \/ /__/ __ |/ /__/ __ |
 /____/\___/_/ |_/____/_/ | |
                          |/  version 2.13.0

scala> :require scala-parallel-collections_2.13-0.2.0.jar
Added '/home/amarki/snips/scala-parallel-collections_2.13-0.2.0.jar' to classpath.

scala> scala.collection.parallel.availableProcessors
                        ^
       error: object parallel is not a member of package collection

--verbose reports

scala> :require scala-parallel-collections_2.13-0.2.0.jar
[classpath updated on entries [ZipArchiveClassPath(/home/amarki/snips/scala-parallel-collections_2.13-0.2.0.jar,None)]]
[could not invalidate system packages: scala.collection]
Added '/home/amarki/snips/scala-parallel-collections_2.13-0.2.0.jar' to classpath.

@SethTisue SethTisue added this to the Backlog milestone Jul 15, 2019

@SethTisue SethTisue added the repl label Jul 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.