Scala Center Monthly Update — November 2021

The mission of the Scala Center is to steward open-source development and education in the Scala ecosystem. The Scala Center creates high-quality free educational material, it creates open-source tools increasing the productivity of Scala developers, and it guides and supports the Scala community.

Dear community,

In this post, we would like to share what the Scala Center team has achieved in November.

Compiler

Scala 3 Support in Scala Native

We ported the Scala Native compiler plugin to Scala 3, which now covers all functionalities known from Scala Native for Scala 2. We researched an additional compiler phase which would adapt the Scala 3 LazyVals implementation, by rewriting unsupported reflective calls to Scala Native intrinsic operations. We rewrote the Scala Native sbt build to allow for safe cross-compilation for all binary versions of Scala and we are currently testing and stabilizing Scala 3 support.

Energy Efficiency of Scala

For Scala 2 and Scala 3

This project assesses the energy efficiency of Scala programs, based on the article “Ranking programming languages by energy efficiency”.

We discovered a flaw in the methodology used by the original authors, causing the JVM to not be correctly warmed up when running Java benchmarks. Because of that, the measurements for Java programs (execution time and energy consumption) were overestimated by about 30%.

We fixed this problem, and we finely tuned the Scala implementations of the benchmarks to reach their maximum potential.

We executed the benchmarks on a dedicated machine, in various languages (C, Java, JavaScript, Python, and Scala). We are currently analyzing the results and preparing a blog article to be published in December.

Scala.js

For Scala 2 and Scala 3

A change in the default configuration of Node.js 17 caused a critical incompatibility with Scala.js. We immediately published a workaround, soon followed by a proper fix. Users of Scala.js who would like to use Node.js 17 are encouraged to read about the issue and how to use its fix until Scala.js 1.8.0 is published.

We also addressed a bad interaction with sbt’s client/server mode, which will be released as part of Scala.js 1.8.0.

Scala 3 Compiler Maintenance

We fixed a bug that caused enum definitions to type check differently depending on whether its companion object was declared before or after the enum in a file. This was caused by checking too early for inheritance of java.lang.Enum, required for synthesis of the ordinal method. We moved the synthesis to after type checking, and improved the content of the error message for when the user tries to implement ordinal themselves. See the PR #13952 for more details.

We have been improving support for incremental compilation of inline methods (PR #12931), specifically when referring to an inline definition from within another inline method. More work is required to investigate a blocking edge-case when using the -sourcepath flag.

Ecosystem

Scaladex

Scaladex is an index for Scala 2 and Scala 3 libraries. The project suffers from usability and reliability issues, which we are currently addressing.

We are close to finishing the refactoring and focusing on the last steps to deploy to production as reported in this issue. We ported the latest missing features such as most recent projects, ElasticSearch synchronization, GitHub information synchronization.

Coursier (SCP-026)

Coursier can be used as an installer for Scala 2 and Scala 3. However, it was reported by the Advisory Board that it suffers from several issues that make it unsuitable for beginners.

We finished all the changes to the coursier CLI that were planned in our roadmap, including:

  • add a feature to make sure that a given application is always installed from its official distribution (e.g., sbt),
  • add a feature to override application settings based on the version, which effectively allows to merge Scala 2 and Scala 3 into a single application,
  • adjust the documentation and help menus to make them more beginner-friendly, focused on the getting started experience.

These changes are currently available in coursier v2.1.0-M1. Once a final release is cut, we will update the official scala-lang.org website to recommend coursier as the default installer everywhere, for Scala 2 and for Scala 3.

sbt

In order to prepare the release of sbt 1.6, we fixed a few bugs with sbt server (#6547, #6698), affecting all versions of Scala.

Metals

We published Metals v0.10.9, which brings:

  • [Scala 3] Type on selection (already working for Scala 2)
  • [Scala 2/3] Extract value code action

Bloop

We published Bloop v1.4.11, which mainly fixes issues with Scala 2.13.7.

Education

MOOCs

We reviewed all the user feedback for Functional Programming Principles in Scala 3. We corrected the material where possible and we are coordinating with MOOC editors at EPFL to fix issues in the video.

We created quiz questions for weeks 1, 2 and 3 of Functional Programming Principles.

We continued improving the content of Effective Scala as imperfections are reported by learners on the forum.

Scala at Universities

We conducted one more interview with Jonathan Brachthäuser.

External Communication

Let’s Talk About Scala 3 Video Series

Series of short videos about Scala 3, covering a variety of themes like how to get started, how to take advantage of the new language features, or how to migrate from Scala 2.

We filmed a new video about Program Entry Points in Scala 3. We are also in the process of writing a beginner oriented video about domain modelling and business logic with Scala 2 and/or Scala 3.

LinkedIn

We announced our arrival on LinkedIn and started posting on November 23. We currently have a total of 5 posts.

We met our initial 200 followers goal in one week, with 273 followers. Our engagement rate is fluctuating between 5 and 9% (compared to the 2% recommended engagement rate).

Advent of Code

We are happy to participate in the Advent of Code. This is an opportunity for us to connect with the community on this fun challenge, and to showcase Scala as a good language to solve programming puzzles.

We published a website for this purpose.

Inclusive Language Guide (SCP-025)

We finished the inclusive language guide requested by our advisory board. In the past month, we gathered feedback from key parties involved in the development of Scala and adapted the guide accordingly. It is now published at Inclusive Language Guide | The Scala Programming Language

Scala Website Investigation

We conducted an investigation into the websites of other programming languages, comparing the beginner experience with that of scala-lang.org, and the impact that could be delivered in the future.

20 Likes