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 -e "import util._" deemed useful #7806

Open
scabug opened this issue Sep 3, 2013 · 5 comments
Open

REPL -e "import util._" deemed useful #7806

scabug opened this issue Sep 3, 2013 · 5 comments
Milestone

Comments

@scabug
Copy link

scabug commented Sep 3, 2013

From SO,
http://stackoverflow.com/a/18510229/1296806

Someone wanted to import packages on the command line. I said put it in a -i file. Hey, he didn't give me the green check! Anyway, I noticed this throws CNF: Main:

scala -e "import util._"

when it would actually be friendlier to handle the imports and drop into interactive mode.

It might be nice to have a way to do arbitrary -e exprs and drop into interactive mode. I guess we can't use -i for interactive.

@scabug
Copy link
Author

scabug commented Sep 3, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7806?orig=1
Reporter: @som-snytt
Affected Versions: 2.10.2
See #5254

@scabug
Copy link
Author

scabug commented Aug 26, 2014

@gourlaysama said:
This sort of duplicates #5254. Or the issue could be about having a way to drop into the REPL after -e (keeping those classes on the classpath, or course...)

@scabug
Copy link
Author

scabug commented Aug 26, 2014

@som-snytt said:
Upgraded to improvement for the feature request. Or is that a downgrade?

@som-snytt
Copy link

som-snytt commented Dec 1, 2019

The workaround is -Xscript foo. For some reason, the default -Xscript Main disables wrapping. I can't focus on why, at the moment, because of all the domestic turmoil.

Dropping into REPL after -e would be an anti-feature.

Edit: the problem is that -Xscript indicates "code is script" and also specifies the entry point; there is no way to differentiate "find the entry point" or "create it". The problem would be mitigated by picking a more obscure default name than Main. On default, if search fails, then wrap.

@som-snytt
Copy link

The script runner is not the REPL, and failing to run is a bug, not an improvement.

@SethTisue SethTisue added this to the Backlog milestone Dec 1, 2019
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

3 participants