|Scala 3 Released With Major Changes|
|Tuesday, 29 June 2021|
Scala 3 has been released. The new version has been eight years in development, and according to the developers is a complete overhaul of the Scala language. Many aspects of the type-system have been changed, meaning that type-inference and overload resolution are much improved.
Scala combines object-oriented and functional programming in one concise, high-level language. Scala is a statically typed, object-oriented, functional language, which runs on the JVM and has some interesting parallel processing constructs based on the actor model. An actor is essentially an object that runs concurrently and engages in message passing.
Scala was released publicly in 2004 as an open source project under the BSD licence and Version 2 was released in 2006. In January 2011 the Scala team was awarded a grant of 2.3 million euros over 5 years to implement parallel processing features which allowed the team to expand.
The developers have worked on the entire Scala language, starting with the type system. The changes to this enable new features such as union types, and also mean that the type-system is less obtrusive and type-inference and overload resolution are much improved.
Alongside the improved type inference, the Scala 3 type system has new features including redesigned enums that blend well with case classes and form the new standard to express algebraic data types; opaque types that can hide implementation details; and intersection and union types.
There are also new dependent function types, polymorphic function types. and type lambdas.
The new release also has a new “quiet” syntax for control structures like if, while, and for. The quiet syntax doesn't rely on enclosing the condition in parentheses, and also allows to drop parentheses or braces around the generators of a for-expression. The new keyword is now optional, and optional braces allow for "a distraction-free, indentation sensitive style of programming".
The developers have also worked on 'contextual abstractions'. The development team says that one underlying core concept of Scala has been to provide users with a small set of powerful features that can be combined. Scala 3 takes a slightly different approach and focuses on intent rather than mechanism. Instead of offering one very powerful feature, Scala 3 offers multiple tailored language features, allowing programmers to directly express their intent. Examples include abstracting over contextual information by using clauses so programmers can abstract over information that is available in the calling context and should be passed implicitly; and providing Type-class instances to define the canonical value of a certain type.
Scala 3 is available for download now from the Scala website.
or email your comment to: email@example.com