Scala 3.6.4 release thread

Scala 3.6.4-RC1 is now ready for tests!

Highlights of the release:

  • JDK 24 support
  • REPL init script setting #22206
  • Deprecated scalac setting -Yno-decode-stacktraces is now an alias for -Xno-enrich-error-messages #22208

For a full list of changes and contributor credits, please refer to the release notes

The stable release is planned for February 18th

3 Likes

I can’t get the option to work; am i doing something wrong?

$ scala repl -S 3.6.4-RC1 --repl-init-script 'println("Hello")'
Unrecognized argument: --repl-init-script

To list all available options, run
  scala repl --help

But it works inside the repl:

bjornr@bjornux:~$ scala repl -S 3.6.4-RC1
Welcome to Scala 3.6.4-RC1 (21.0.5, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
                                                                                                                              
scala> :reset --repl-init-script:'println("Hello")'
Resetting REPL state with the following settings:
  --repl-init-script:println("Hello")

Hello
                                                                                                                              
scala> 

It’s from “ouside” using the code from command line which is the important use case; so you can pass an import for instance…

REPL is confusing me

$ scala repl -S 3.6.4-RC1
Downloading Scala 3.6.4-RC1 compiler
Downloading Scala 3.6.4-RC1 bridge
Welcome to Scala 3.6.4-RC1 (21.0.5, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
                                                                                                                                                                                                                                        
scala> println(util.Properties.versionString)
version 2.13.15

see Scala FAQ | Scala Documentation

try scala repl -S 3.6.4-RC1 -O --repl-init-script ...

if I understand correctly, scala-cli recognizes certain options as being compiler/REPL options and doesn’t require the -O, but this is one it apparently doesn’t know yet, so the -O is necessary

@bjornregnell it’s a REPL flag, not a Scala CLI or compiler one.
You pass it to the launched app, so to the REPL in this case, so after --.

scala repl -S 3.6.4-RC1 -- --repl-init-script 'println("Hello")'
Hello
Welcome to Scala 3.6.4-RC1 (23.0.1, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
                                                                                                                 
scala> 

This will work.

The feature is also still worked on, as tracked under Add a setting/API to run a code snippet/script in the REPL on startup · Issue #21242 · scala/scala3 · GitHub
We may add a more intuitive way of passing an init script (although the syntax above is quite simple already, I think).

1 Like

AHA!! Many thanks. Finally Scala 3 can do what I have longed for:

Super-thanks to all contributors of this feature!!!

3 Likes

ah, thanks for the correction, TIL