Paul Krill
Editor at Large

Scala stabilizes named tuples

news
May 13, 20252 mins

Scala 3.7.0 release also brings a compiler fix that addresses runtime errors on the Android platform due to stricter type constraints on lambdas.

Side view portrait of modern IT developer using computer in office while working on VR games and software, copy space
Credit: SeventyFour / Shutterstock

Scala 3.7.0, the latest version of the object-oriented, functional language with JVM, native, and JavaScript runtimes, stabilizes named tuples and brings a “crucial” fix that enhances its compatibility with Android.

Scala 3.7.0 was announced May 7. Installation instructions can be found at scala-lang.org.

In Scala 3.7.0, named tuples, introduced as experimental in Scala 3.5 in August 2024, become stable. Named tuples provide a convenient way to return multiple results from a function or to model the data using tuples, while allowing developers to use meaningful names for its fields, Wojciech Mazur of VirtusLab wrote in a blog post announcing the release. 

Meanwhile, a compiler fix in Scala 3.7.0 enhances the language’s compatibility with the Android platform. Developers had faced issues when compiling Scala 3 code for Android due to the Android Runtime (ART) enforcing stricter type constraints on lambdas than the standard JVM. ART requires that the return type of a Single Abstract Method (SAM) interface be a primitive type or explicitly boxed, a condition not required by the JVM. The update modifies the Scala compiler to box the return type of native instantiated methods when the SAM’s return type is not primitive.

Also in Scala 3.7.0, case classes now may have dependent fields, thus boosting expressiveness and type safety. This allows fields within a case class to depend on other constructor parameters via path-dependent types. Other improvements in Scala 3.7.0 include the following:

  • Dependencies can be brought to an already-running REPL session via the :jar command.
  • For library maintainers, Scala 3.7.0 stabilizes the @publicInBinary annotation, which was introduced experimentally in Scala 3.4. This annotation ensures binary compatibility when inline methods access non-public members and prevents generation of redundant accessors required by Scala’s inlining mechanism.
  • Scala 3.7.0 introduces the concept of preview features, which are fully implemented and SIP-approved (Scala Improvement Process), but potentially subject to small refinements before becoming stable. The first preview feature is for comprehension improvements, which was added to Scala 3.6.0 as experimental.
Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author

  翻译: