Skip to content

Conversation

@lihaoyi
Copy link
Contributor

@lihaoyi lihaoyi commented Oct 31, 2025

This has several advantages:

  • Avoids wasting horizontal space, which is at a premium in the terminal
  • Removing the |s for multi-line input makes it much easier to copy-paste later: you can copy-paste-dedent it, rather than copy-paste-remove-vertical-pipes-dedent like you needed to do before
  • Compared to other 1-character prompts, @ is already associated with Scala due to widespread usage of Ammonite, so people seeing this would immediately know it's a Scala REPL

Most languages REPLs do not have the name of the language in the prompt (e.g. Python is >>>, IPython In [N], Ruby irb(main):001:0>, Node >, etc.) so it's not a hard requirement to have the language name scala in the REPL prompt

@hamzaremmal
Copy link
Member

@lihaoyi The PR extracting the repl has been merged. Can you please rebase now and fix the conflicts?

@lihaoyi
Copy link
Contributor Author

lihaoyi commented Nov 1, 2025

@hamzaremmal Done

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 @

@Gedochao Gedochao added the stat:needs decision Some aspects of this issue need a decision from the maintainance team. label Nov 3, 2025
@SethTisue
Copy link
Member

SethTisue commented Nov 5, 2025

Removing the |s for multi-line input

OMG yes please!! Really happy to see this change included

private def newLinePrompt(using Context) = blue(" | ")
protected def promptStr = "@"
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

@Gedochao
Copy link
Contributor

Gedochao commented Nov 5, 2025

@lihaoyi hey, so we've discussed this on today's Scala Core and the conclusions were as follows:

  • we will keep the default prompt as scala>, rather than change it to anything else
    • the main motivation is to keep the default distinctly different from other shells
    • @ could easily be confused with Ammonite, so that's a no-go as well
  • removing the vertical bars for ease of copy-pasting is actually desired, we can go ahead with that part (I guess this PR could be scoped down to just that)
  • we should make the prompt string configurable (it already is in the Scala 2 REPL)

@Gedochao Gedochao removed the stat:needs decision Some aspects of this issue need a decision from the maintainance team. label Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants