We’re happy to announce the release of Scala Native. It’s the next maintenance release for Scala Native 0.4.x. This release fixes regressions introduced in the previous version and adds some requested features.

The Scala standard library used by this release is based on the following versions:

Scala binary version Scala release
2.12 2.12.17
2.13 2.13.10
3 3.2.2
Commits since last release 10
Merged PRs 8
Contributors 3

Notable changes

Composable extern definitions using @extern trait

Extern definitions can now be composed using traits annotated as @extern. Extern objects can now be composed using multiple extern traits allowing for better modeling of foreign APIs. A good candidate for modeling C bindings with this approach can be errno.h from C standard library and its POSIX extension. It can now be modeled as following

import scala.scalanative.unsafe.*

@extern trait errnoC {
  var errno: CInt = extern
  
  def EILSEQ: CInt = extern
}

@extern trait errnoPosix extends errnoC {
  def EWOULDBLOCK: CInt = extern
  def EINPROGRESS: CInt = extern
  def EINTR: CInt = extern
}

@extern object errno extends errnoC with errnoPosix

The current bindings of POSIX and C standard library are not affected by this change, however, new model would be used in Scala Native 0.5.x

Contributors

Big thanks to everybody who contributed to this release or reported an issue!

$ git shortlog -sn --no-merges v0.4.11..v0.4.12
    8 Wojciech Mazur
    1 Eric K Richardson
    1 LeeTibbert

Merged PRs

(2023-03-22)

Full Changelog

Merged pull requests:

POSIX bindings

Compiler plugin

Toolchain