A next-generation compiler for Scala
(scroll down for more info)
There are multiple ways of getting started with Scala 3.
cs setup
. You can also run cs install scala3-compiler
or cs install scala3-repl
to install command-line commands for the compiler and repl, correspondingly.If you are a Mac user, you can install Scala 3 with brew:
brew install lampepfl/brew/dotty
If you are a Linux or Windows user, as a prerequisite you need a JDK 8 or later properly installed on your system. The environment variable JAVA_HOME
should point to your Java installation.
For Windows users, we recommend using the Windows subsystem for linux or some other bash shell like git bash.
Then download the latest release. Optionally add the path of the folder bin/
to the system environment variable PATH
.
Now you can compile Scala source code:
scalac hello.scala
To start the REPL, run: scala
.
The fastest way to create a new project in Scala 3 is using sbt (1.1.4+).
Create a Scala 3 project:
sbt new lampepfl/dotty.g8
Or a Scala 3 project that cross compiles with Scala 2:
sbt new lampepfl/dotty-cross.g8
For documentation see the Scala 3 Example Project.
You can find much more information about Scala 3 in ...