Skip to content

Commit 70bda7c

Browse files
committed
[docs] LibraryEvolution: This is about binary compatibility.
...and can't guarantee semantic compatibility. Make this clear in the introduction, as noted by David Owens.
1 parent 44bf526 commit 70bda7c

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

docs/LibraryEvolution.rst

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ published should not limit its evolution in the future.
4848

4949
- Drew Crawford is concerned about inlineable code breaking modularity;
5050
you can't just release a new dylib to fix a bug.
51-
- David Owens wants it to be clearer that this document doesn't really
52-
cover behavior changes and proper semantic versioning, just binary
53-
compatibility.
5451

5552

5653
Introduction
@@ -69,6 +66,23 @@ This document will frequently refer to a *library* which vends public APIs, and
6966
a single *client* that uses them. The same principles apply even when multiple
7067
libraries and multiple clients are involved.
7168

69+
This document is primarily concerned with `binary compatibility`, i.e. what
70+
changes can safely be made to a library between releases that will not break
71+
memory-safety or type-safety, or cause clients to fail to run at all. A
72+
secondary concern is identifying `binary-compatible source-breaking changes
73+
<binary-compatible source-breaking change>`, where clients compiled against the
74+
previous version of a library are likely to behave differently than clients
75+
compiled against the new version of the library.
76+
77+
.. note::
78+
79+
These rules do not (and cannot) guarantee that a change is *semantically*
80+
backwards-compatible or forwards-compatible. *Any* change to a library's
81+
existing API that affects its observable behavior may affect clients. It is
82+
the responsibility of a library author to be sure that the changes they are
83+
making are *semantically* correct, preserving the preconditions,
84+
postconditions, and invariants of previously-published APIs.
85+
7286
This model is largely not of interest to libraries that are bundled with their
7387
clients (distribution via source, static library, or embedded/sandboxed dynamic
7488
library, as used by the `Swift Package Manager`_). Because a client always uses
@@ -177,11 +191,6 @@ library (barring their own availability checks), since the entire library is
177191
shipped as a unit. That is, even if a particular API was introduced in v1.0,
178192
its (non-public) implementation may refer to APIs introduced in later versions.
179193

180-
Swift libraries are strongly encouraged to use `semantic versioning`_, but this
181-
is not enforced by the language.
182-
183-
.. _semantic versioning: http://semver.org
184-
185194
Certain uses of ``internal`` entities require them to be part of a library's
186195
binary interface, which means they need to be versioned as well. See
187196
`Versioning Internal Declarations`_ below.

0 commit comments

Comments
 (0)