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

Command line interface breaks eval (-e) #12648

Closed
ches opened this issue May 30, 2021 · 2 comments
Closed

Command line interface breaks eval (-e) #12648

ches opened this issue May 30, 2021 · 2 comments
Assignees

Comments

@ches
Copy link

ches commented May 30, 2021

Similar to #12647 and again referencing lampepfl/dotty-feature-requests#131 as an umbrella of REPL parity and whether any of it is regression vs. enhancement.

While -i is mostly an interactive usage nice-to-have, -e may be more impactful in breaking scripts in the wild.

I've raised this independently also to ask/determine "policy" of command line interface breakage in general, and how distribution packagers treat executable names.

The official foremost recommended installation method for Scala 3 presently is Coursier—resulting in new executables of scala3-repl and scala3-compiler—but distribution packagers are unlikely to use that approach. The official dotty Homebrew formula maintains the scala and scalac executables. I believe many distribution channels are doing the same. So, it's fair to say CLI breakage is a material consideration.

Side note: the REPL- and script runner-specific scala -help output in Scala 2 is a nicer experience IMO than Scala 3 echoing exactly the compiler usage. I'm not sure there are any REPL-specific options at this point, so filing an enhancement for this might not make sense, yet? It would be nice to summarize how script running works like the old help did, perhaps it's not appropriate to call it "script running" if synthesizing a main method etc. is no longer a feature, but the convenience of on-the-fly compiling a given source file remains.

Also, scalac -script is undocumented in -help.

Compiler version

3.0.0

Minimized code

$ /usr/local/Cellar/dotty/3.0.0/bin/scala -e 'println("Hello, world!")'

Output

/usr/local/Cellar/dotty/3.0.0/bin/scala: eval: line 162: syntax error near unexpected token `('

(Missing feature aside, this seems like less than ideal option handling in the wrapper shell script, versus):

$ /usr/local/Cellar/dotty/3.0.0/bin/scala -e 'println'
Unrecognized option: -e

Expectation

$ /usr/local/Cellar/scala/2.13.6/bin/scala -e 'println("Hello, world!")'
Hello, world!
@philwalk
Copy link
Contributor

A proposed implementation is here: #14263

@anatoliykmetyuk
Copy link
Contributor

Proposed implementation merged.

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

4 participants