Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News The Road to Swift 4 ABI Stability

The Road to Swift 4 ABI Stability

This item in japanese


Recently announced on the swift-evolution mailing list, the Swift ABI Stability Manifesto aims to be a compilation of all concerns that need to be addressed before Swift’s ABI can be declared stable.

The goal of ABI stability has two main parts, writes Apple engineer Michael Ilseman, author of the document:

  • Defining a module file containing a standardized representation of Swift compiler’s description of the public framework’s API to be bundled with the executable code that is loaded at runtime.
  • Defining a set of conventions affecting many low level details, such as how to call a function, how to represent data and metadata in memory, etc.

In particular, Ilseman identifies six areas where work needs to be done:

  • data layout, which defines how struct and class instances are laid out in memory.
  • type metadata, which requires either a specific memory layout or a query API.
  • name mangling, which defines how the compiler uniquely identifies external symbols, such as types and functions.
  • function calling conventions, which defines how arguments are passed into/out from functions, which registers are preserved, etc.
  • the Swift runtime, which is part of the ABI since it provides basic mechanisms for dynamic casting, reference counting, reflection, etc.
  • standard library, whose API is part of the ABI since apps and libraries will call into it.

ABI stability is one of the top-priority features planned for Swift 4 and is crucial for third-party framework developers. As InfoQ reported, ABI stability did not make it into Swift 3 due to the impossibility of defining some aspects of the language that needed to be defined before locking down the ABI. In a recent interview for the Accidental Tech podcast, Swift creator and former Apple engineer Chris Lattner stated that ABI stability is not as important as it might seem for app developers, but “it is really important for Apple” and a key factor for Swift adoption inside of the organization:

The Swift team itself has specific goals they need to achieve before there can be truly, across-the-board adoption at Apple. ABI stability is the number one thing that prevents framework developers, for example, from adopting Swift. That’s a really important thing. That’s one of the reasons it’s always a really high priority.

In actuality, it is still not entirely clear whether Swift 4 ABI will be declared stable or not. This could be a consequence of the sheer amount of work ABI stability entails and of the fact that it may be not the most important thing for the Swift community, says Lattner.

I wouldn’t be surprised if, at some point, they decide that focusing on that is more important than nailing ABI stability in Swift 4.

Among the higher-level priorities for the community, Lattner singles out making the compiler more reliable, having better error messages, speeding up compile times, and making Swift scale better to large projects.

Rate this Article


Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p