Navigation
Search
|
Scala stabilizes named tuples
Wednesday May 14, 2025. 05:12 AM , from InfoWorld
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.
https://www.infoworld.com/article/3984541/scala-stabilizes-named-tuples.html
Related News |
25 sources
Current Date
May, Wed 14 - 14:53 CEST
|