The latest upgrade of the popular functional language for JVM and JavaScript runtimes features a new type system, new language features, and scads of syntax improvements. Credit: Thinkstock Scala 3, the latest version of the object-oriented, functional language with JVM and JavaScript runtimes, is now available as a production release. The upgrade, described by the project as a “complete overhaul,” features a new type system and syntax improvements. The production release of Scala 3 was introduced May 14, following a release candidate stage that began on February 17. Among the improvements noted in the release is a new “quiet” syntax for control structures such as if, while, and for. [ Also on InfoWorld: JDK 17: The new features in Java 17 ] Scala has both JVM and JavaScript runtimes and is positioned for use in building high-performance systems with access to ecosystems of libraries. Instructions for downloading Scala 3 can be found here. Other syntax improvements in Scala 3: Optional braces that support a distraction-free, indentation-sensitive style of programming. The new keyword is now optional. Type-level wildcards have been changed from _ to ?. Implicits and their syntax have been heavily revised. New language features in Scala 3: In an improvement over Scala 2 implicits, using clauses can be specified by type, freeing function signatures from term variable names that are never explicitly referred to. Given instances allow programmers to determine the canonical value of a certain type, making programming with type-classes more straightforward, without leaking implementation details. Extension methods are now directly built into the language, for better error messages and improved type inference. Implicit conversions have been redesigned as instances of a type-class Conversion. A context functions feature makes contextual abstractions a first-class citizen. These serve as a tool for library authors to express concise domain-specific languages. If an implicit parameter cannot be resolved by the compiler, import suggestions are provided that may fix the problem. Type system improvements in Scala 3: Enums, or enumerations, have been redesigned to blend well with case classes and form the new standard to express algebraic data types. Opaque type aliases enable developers to hide implementation details without taking a performance hit. Intersection and union types enable expression of type constraints outside the inheritance hierarchy. Polymorphic function types can abstract over functions that take type arguments in addition to their value arguments. Type lambdas are type-level functions that can be passed as type arguments without needing an auxiliary type definition. Rather than encoding type-level computation using implicit resolution, Scala 3 supports matching on types. Object-oriented programming features in Scala 3: Traits move closer to classes and now can take parameters, thus making them more powerful as a tool for modular software decomposition. Open classes require library designers to mark classes as open. Utility traits that implement behavior sometimes ought not be part of inferred types. With Scala 3, those traits can be marked as transparent, hiding the inheritance from the user. Explicit null moves null out of the type hierarchy, for catching errors statically. Additional checks for safe initialization find access to unitialized objects. Scala 3 also offers tools for metaprogramming, including compile-time operations, quoted code blocks, and an inline feature that allows values and methods to be reduced at compile time. Related content news Akka distributed computing platform adds Java SDK Akka enables development of applications that are primarily event-driven, deployable on Akka’s serverless platform or on AWS, Azure, or GCP cloud instances. By Paul Krill Nov 18, 2024 2 mins Java Scala Serverless Computing news Scala.js 1.0.0 improves JavaScript interoperability Version of the Scala programming language that compiles to JavaScript has reached GA status By Paul Krill Feb 28, 2020 1 min Java JavaScript Web Development news Scala 2.13 overhauls collections, improves the standard library The functional and object-oriented language with JVM and JavaScript runtimes gains performance, safety, and simplicity improvements By Paul Krill Jun 13, 2019 2 mins Java Scala Programming Languages Resources Videos