Skip to content

Conversation

@taku0
Copy link
Contributor

@taku0 taku0 commented Apr 7, 2018

JEP 293 specifies GNU-like styles for java/javac/etc. command-line options, which is supported by OpenJDK/Oracle JDK from version 9.

This patch adds synonyms with two hyphens for each options.

Option summary:

scala options:

short long
-howtorun --how-to-run
-I (no long option)
-i (no long option)
-e (no long option)
-save --save
-nc --no-compilation-daemon

fsc options:

short long
-current-dir --current-directory
-reset --reset
-shutdown --shutdown
-server --server
-port --port
-ipv4 --ipv4
-max-idle --max-idle

scalac options:

short long
-bootclasspath --boot-class-path
-extdirs --extension-directories
-javabootclasspath --java-boot-class-path
-javaextdirs --java-extension-directories
-sourcepath --source-path
-dependencyfile --dependency-file
-deprecation --deprecation
-encoding --encoding
-explaintypes --explain-types
-feature --feature
-g (no long option)
-help --help
-nowarn --no-warnings
-print --print
-target --target
-unchecked --unchecked
-uniqid --unique-id
-usejavacp --use-java-class-path
-usemanifestcp --use-manifest-class-path
-verbose --verbose
-version --version
-toolcp --tool-class-path
-nobootcp --no-boot-class-path
-classpath --class-path
-no-specialization --no-specialization
-language --language
-release --release
-X* (no long option)
-Y* (no long option)
-J* (no long option)
-D* (no long option)
-opt* (no long option)
-optimise (no long option)
-P (no long option)

@scala-jenkins scala-jenkins added this to the 2.13.0-M4 milestone Apr 7, 2018
@retronym
Copy link
Member

retronym commented Apr 8, 2018

We should apply this to the the scaladoc settings, too.

I support this change, as it will reduce the friction for people using the forthcoming support for Java Modules in Scala 2.13. They'll be learning about --module-path, etc, from Java-oriented tutorials.

It is worth discussing alternatives, though, e.g smart usage help.

Replace:

⚡ scalac --class-path foo
scalac error: bad option: '--class-path'
  scalac -help  gives more information

With

⚡ scalac --class-path foo
scalac error: bad option: '--class-path' (did you mean -classpath`)
  scalac -help  gives more information

In the same spirit as:

⚡ java -XX:UseCH -version
Unrecognized VM option 'UseCH'
Did you mean '(+/-)UseCHA'? Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

That would be a useful change in and of itself.

So assuming we had that, what is better?

Outcome Smart Help GNU Abbreviations (this PR) GNU primary, current options as abbreviations
Fragmentation Good Bad, usage and documentation will gradually fragment Very bad, new and old usage/documentation will immediatlely fragment
User friendliness Okay Good, DWIM Good, DWIM
Consistency with Javac Poor Okay Good

@taku0
Copy link
Contributor Author

taku0 commented Apr 12, 2018

Updated scaladoc.

@taku0
Copy link
Contributor Author

taku0 commented Apr 12, 2018

Is this too much?

⚡ scalac --class-path foo --encoding UTF-8
scalac error: bad options: '--class-path' and '--encoding' (did you mean '-classpath' and '-encoding')
Try
  scalac -classpath foo -encoding UTF-8
or  scalac -help  for more information

@szeiger szeiger modified the milestones: 2.13.0-M4, 2.13.0-M5 May 2, 2018
@adriaanm
Copy link
Contributor

adriaanm commented Jun 1, 2018

I like the improved usability with the abbreviations. I'm not that worried about the fragmentation because the alternative spelling is easily discovered. If I don't hear strong objections by June 8, I intend to merge as-is. (cc @retronym)

@SethTisue
Copy link
Member

👍, aligning with JEP 293 and with good Unix practice is worth the fragmentation. We could wait a good long time before removing the old versions (not til Scala 3.x, I guess, if ever).

@SethTisue SethTisue added the release-notes worth highlighting in next release notes label Jun 6, 2018
@SethTisue
Copy link
Member

@taku0 hi, you still around? this could make M5; can you rebase?

@SethTisue SethTisue self-assigned this Aug 7, 2018
taku0 added 2 commits August 7, 2018 20:49
JEP 293 specifies GNU-like styles for command-line options, which is
supported from OpenJDK/Oracle JDK 9.

This patch adds synonyms with two hyphens for each options.
Option names consist with multiple words are separated by hyphens.
@taku0 taku0 force-pushed the topic/double-hyphen-options branch from 99ea6f8 to a9812ac Compare August 7, 2018 12:27
@taku0
Copy link
Contributor Author

taku0 commented Aug 7, 2018

Rebased

@SethTisue
Copy link
Member

thank you @taku0!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes worth highlighting in next release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants