Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions repl/src/dotty/tools/repl/JLineTerminal.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ class JLineTerminal extends java.io.Closeable {
builder.build()
private val history = new DefaultHistory

private def blue(str: String)(using Context) =
if (ctx.settings.color.value != "never") Console.BLUE + str + Console.RESET
private def purple(str: String)(using Context) =
if (ctx.settings.color.value != "never") Console.MAGENTA + str + Console.RESET
else str
protected def promptStr = "scala"
private def prompt(using Context) = blue(s"\n$promptStr> ")
private def newLinePrompt(using Context) = blue(" | ")
protected def promptStr = "@"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ is a cute symbol for ammonite (the name), but that cuteness does not apply for Scala in general. There's no precedent (that I know of) for this symbol being used as a general prompt anywhere.

I'm not against using a short prompt but then it should just be > like virtually all prompts in existence.

Copy link
Contributor Author

@lihaoyi lihaoyi Nov 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A large motivation for the recent effort to renovate the REPL has been to merge all the useful parts of Ammonite into it: pretty-printed output, ctrl-c handling, library import, etc.. I expect Ammonite as a standalone project will go into maintenance mode soon after 3.8.0 is released.

Given that, @ looking like the Ammonite REPL is exactly what we want: for all intents and purposes, Ammonite going forward will be the default Scala REPL, and any association that people have with the @ symbol is exactly right.

We can come up with a new symbol, we can use > which is shared by a bunch of other REPLs. But @ is already widely known in the Scala community, has exactly the right associations (Scala REPL ++) and soon-to-be unambigious. So there's plenty of upsides of using this symbol and no long-term downsides

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that, @ looking like the Ammonite REPL is exactly what we want: for all intents and purposes, Ammonite going forward will be the default Scala REPL, and any association that people have with the @ symbol is exactly right.

...wait, slow down. While we very much appreciate all the improvements brought over from Ammonite REPL, Scala REPL remains its own thing. If anything, I think users may be confused with the @ being there. Some Ammonite REPL features won't be brought over (like the Ammonite style directives, for example).

I'm a fan of going with > myself, too.
We'll discuss how to move forward on Scala Core.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe instead of having long discussions, trying to figure out what would be best for users, maybe we could let them decide themselves? Personally, I've recently become a bit crazy about how one can make their life easier by customizing their shell prompt, but I wouldn't go too far for this moment. The prompt in the REPL could be configurable as a simple string (and maybe as a color) via a scala-cli flag (or potentially also via a directive to let people use a scala file as a template for REPL settings)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...we probably could make whatever we decide on customisable, yeah. 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with > if that's what you all prefer, just let me know the decision and I'll update the PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the arguments against @

private def prompt(using Context) = purple(s"\n$promptStr ")
private def newLinePrompt(using Context) = purple(" ")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is my personal preference. If we were to have a > on the first line then maybe it's best to have one also in the lines after that to be able to easily keeps things aligned.

Suggested change
private def newLinePrompt(using Context) = purple(" ")
private def newLinePrompt(using Context) = purple(">")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with adding >s in subsequent lines is it makes copy paste harder. Without the > you just copy-paste-dedent, with the > you paste and the need to remove the > from each subsequent line, and also manually remove the space since it'll be one remaining space so a 2-space dedent doesnt work


/** Blockingly read line from `System.in`
*
Expand Down
Loading