8000 some Scala 2 REPL commands should be "deprecated" if not implemented in Scala 3 · Issue #13080 · scala/bug · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

some Scala 2 REPL commands should be "deprecated" if not implemented in Scala 3 #13080

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

Open
SethTisue opened this issue Jan 22, 2025 · 5 comments 8000
Assignees
Labels
Milestone

Comments

@SethTisue
Copy link
Member
SethTisue commented Jan 22, 2025

as discussed with @Gedochao at Scala core meeting today

in reference to e.g. scala/scala3#21657 about Scala 2's :sh command, but there are probably other such commands as well

if I understand correctly, the idea isn't to slate anything for actual removal from Scala 2, but just have unimplemented-in-3 commands print a one-line warning (on first use in a session, but not again in that session) that the command is unimplemented in Scala 3

and I suggest we also make this distinction show up in :help, which currently looks like

scala 2.13.16> :help
All commands can be abbreviated, e.g., :he instead of :help.
:help [command]          print this summary or command-specific help
:completions <string>    output completions for the given string
:imports [name name ...] show import history, identifying sources of names
:implicits [-v]          show the implicits in scope
:javap <path|class>      disassemble a file or class name
:line <id>|<line>        place line(s) at the end of history
:load <path>             interpret lines in a file
:paste [-raw] [path]     enter paste mode or paste a file
:power                   enable power user mode
:quit                    exit the REPL
:replay [options]        reset the REPL and replay all previous commands
:require <path>          add a jar to the classpath
:reset [options]         reset the REPL to its initial state, forgetting all session entries
:save <path>             save replayable session to a file
:sh <command line>       run a shell command (result is implicitly => List[String])
:settings <options>      update compiler options, if possible; see reset
:silent                  disable/enable automatic printing of results
:type [-v] <expr>        display the type of an expression without evaluating it
:kind [-v] <type>        display the kind of a type. see also :help kind
:warnings                show the suppressed warnings from the most recent line which had any

off the top of my head: I think we could have two sections, the first would be the core commands that both REPLs support, then a second section with the rest

@SethTisue SethTisue added this to the 2.13.17 milestone Jan 22, 2025
@SethTisue SethTisue self-assigned this Jan 22, 2025
@SethTisue SethTisue added the repl label Jan 22, 2025
@som-snytt
Copy link

It makes more sense for Scala 3 to say "sorry, I don't support that useful Scala 2 command".

If a command isn't useful, it should be removed.

Is :javap useful? I use it daily to see what the compiler actually did. But the PR is stuck in dotty.

I agree that it's a nuisance when scala 3 doesn't support the same options as scala 2. It would be nice, but unreasonable, to hold REPL to a higher compatibility standard.

@SethTisue
Copy link
Member Author
SethTisue commented Jan 22, 2025

It makes more sense for Scala 3 to say "sorry, I don't support that useful Scala 2 command".

yes! the idea is to do that too, at least for :sh, which will suggest sys.process instead. perhaps there are other commands that could be treated similarly

If a command isn't useful, it should be removed.

hmm.... although that sounds appealing in theory, in practice I don't think it's really that simple (no existing command has literally zero usefulness), and removing things from 2 without a strong motivation just risks annoying people

another thought: even separately from the 2 vs 3 considerations, I think having the help text in two sections (core commands and additional commands) is probably a UX improvement. here's the things you should definitely know, and here are some additional things that might also interest you

@SethTisue
Copy link
Member Author

Is :javap useful? I use it daily to see what the compiler actually did. But the PR is stuck in dotty.

yeah, that's unfortunate. I've long intended to try to get it over the finish line :-/

@som-snytt
Copy link

annoying people

That is called "telemetry". (Joke from yesterday's walk outside.)

:sh, which will suggest sys.process

maybe suggest amm

or, :amm command to swap out the repl with ammonite.

@SethTisue
Copy link
Member Author

as per scala/scala3#21660 , :paste is one of the commands that won't be implemented in Scala 3 and is now mostly extraneous in Scala 2, as per scala/scala3#21660 and https://users.scala-lang.org/t/solved-cannot-use-paste-in-scala3-repl

I say "mostly" extraneous in Scala 2 because I think we compiler developers sometimes use :paste -raw to bypass the REPL wrapping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants
0