From e6e40b9b3d8d8508c83b18452f7326a0cb4c461c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marks?= Date: Wed, 7 Aug 2024 05:32:40 -0700 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Seth Tisue --- blog/_posts/2024-10-15-scala-3.5.0-released.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/blog/_posts/2024-10-15-scala-3.5.0-released.md b/blog/_posts/2024-10-15-scala-3.5.0-released.md index 6781cb5e9..394e7ae1e 100644 --- a/blog/_posts/2024-10-15-scala-3.5.0-released.md +++ b/blog/_posts/2024-10-15-scala-3.5.0-released.md @@ -7,15 +7,15 @@ title: Scala 3.5.0 released! ![Scala 3.5]({{ site.baseurl }}/resources/img/scala-3.5-launch.jpg) -We are happy to announce that after the long and hard work of the entire compiler team and seven release candidates, the first version of the Scala 3.5 line is officially out! +We are happy to announce that after long and hard work by the entire compiler team, and after seven release candidates, the first version of the Scala 3.5 line is officially out! ## New default runner - Scala CLI -[Scala CLI](https://scala-cli.virtuslab.org/) is a popular tool among Scala devs. It allows lightning-fast running, testing, and prototyping of small Scala projects and scripts. Since 3.5.0, it has become a part of the default Scala distribution. If you install Scala through popular package managers, such as Brew or SDKMAN!, the installed `scala` command will allow you to compile, run, test, and even publish your code on Maven Central. It will have out-of-the-box support using-directives, toolkits, compilation to native and js targets, and other goodies formerly available only if you installed a third-party tool. +[Scala CLI](https://scala-cli.virtuslab.org/) is a popular tool among Scala devs. It allows lightning-fast running, testing, and prototyping of Scala scripts and single-module projects. In 3.5.0, it becomes part of the default Scala distribution. If you install Scala through popular package managers, such as Brew or SDKMAN!, the installed `scala` command allows you to compile, run, test, and even publish your code on Maven Central. It has out-of-the-box support for `using` directives, toolkits, compilation to JavaScript and native binaries, and other goodies formerly available only if you installed a separate tool. ### Short example -If we have the following file named `biggerThan.scala` +Given the following file named `biggerThan.scala` ```scala //> using dep com.lihaoyi::os-lib:0.10.3 @@ -27,23 +27,23 @@ If we have the following file named `biggerThan.scala` .foreach(println) ``` -We can run `scala biggerThan -- ../my-directory 10`. This will download the os-lib and all its transitive dependencies, then compile the source file, and finally run the compiled program, printing all files in `../my-directory` bigger than 10 kB. Subsequent invocations of the command will use cached binary, or in case of changes in the file, trigger incremental compilation. +We can run `scala biggerThan -- ../my-directory 10`. This will download os-lib and its transitive dependencies, compile the source code, and finally run the compiled program, printing all files in `../my-directory` bigger than 10 kB. Subsequent invocations of the command will use cached bytecode, or if the source code changed, trigger incremental compilation. -As os-lib is a part of the default Scala toolkit, we can replace the `//> using dep com.lihaoyi::os-lib:0.10.3` line with `//> using toolkit default`. Furthermore, we can add `#!/usr/bin/env -S scala shebang` at the top of the file. Then, after setting the permissions, we can treat `biggerThan.scala` as any executable script. Invoking `./biggerThan.scala ../my-directory 10` will incrementally compile the file and then run it. +As os-lib is a part of the default Scala Toolkit, we can replace `//> using dep com.lihaoyi::os-lib:0.10.3` with `//> using toolkit default`. Furthermore, we can add `#!/usr/bin/env -S scala shebang` at the top of the file. Then, after setting the permissions (`chmod +x biggerThan.scala`), we can treat `biggerThan.scala` like any executable script. Invoking `./biggerThan.scala ../my-directory 10` will incrementally compile the file and then run it. To learn the full scope of the new capabilities, read about Scala CLI [commands](https://scala-cli.virtuslab.org/docs/commands/basics/) and [using-directives](https://scala-cli.virtuslab.org/docs/reference/directives) or glance at [the cookbook](https://scala-cli.virtuslab.org/docs/cookbooks/intro). -Merging Scala CLI into the compiler doesn't change the behavior of popular build tools, such as sbt or Mill. It will, however, allow for maintaining and publishing single-module multiplatform libraries without any build tool. +Merging Scala CLI into the distribution doesn't change the behavior of popular build tools that work with Scala, such as sbt, Mill, Maven, and Gradle. It does, however, allow for maintaining and publishing single-module multiplatform libraries without any build tool. ## What's new in 3.5.0? -### Best Effort Compilation +### Best effort compilation -When using Metals, the IDE functions work great as long as the code passes the compilation. However, once the user starts changing the code, the support drops in quality. This gets worse with a larger number of compilation errors and subsequent modifications. In 3.5.0, we have fixed this problem. We introduced a new mode of compilation called Best Effort Compilation. When enabled, the compiler will output BETASTy files for not compiling code. It can be used by tooling to provide autocompletion and other IDE features. +When using Metals, the IDE functions work great on code that compiles. However, once the user starts changing the code, the support drops in quality. This gets worse with a larger number of compilation errors and subsequent modifications. In 3.5.0, we have fixed this problem. We introduced a new mode of compilation called Best Effort Compilation. When enabled, the compiler will output BETASTy files for not-currently-compiling code. It can be used by tooling to provide autocompletion and other IDE features. To enable the use of BETASTy files in Metals, start the language server with `-Dmetals.enable-best-effort=true` or put that into `metals.serverProperties` setting in VS Code. -### Support for Pipelined Builds +### Support for pipelined builds Scala 3.5.0 supports pipelined compilation. It can be enabled by setting `ThisBuild/usePipelining := true` in sbt build definition. This can result in significant speedups in compilation time for multi-module projects.