15.9 · Binary breaks from innocent changes, and what an import exposes

API evolution is more than deprecation: some harmless-looking source changes break binaries, and an ordinary import can leak more than you meant.

Mental model. A public API is a promise at three levels: the source callers write, the symbols already linked, and the modules a client can see.

Promises that break quietly

Default arguments versus binaries, and import visibility.

  1. Why does adding a defaulted parameter break clients that were already built, and how do you keep the old symbol? 15.9.1 · L5
    Adding timeout: Int = 30 to fetch(id:) looks source compatible: every call site fetch(id: 7) still compiles. But a function’s binary symbol includes its full…
  2. What do internal imports and MemberImportVisibility change, and how do you stop a dependency leaking through your module? 15.9.2 · L5
    A plain import Core in a Swift 6-mode file is, by default, a public import: declarations of Core may appear in your public API, and your client can use them.…
  3. How do you keep an architecture from eroding: dependency rules as executable checks, and what belongs in a decision record? 15.9.3 · L5
    Diagrams and wiki pages do not stop a Friday-evening import. An architecture survives year three when its rules are executable and fail the build. State the…

More in Architecture & API design