Skip to content

Commit a45aebf

Browse files
authored
[SE-0376] Clarify backDeployed attribute
1 parent 9f304b5 commit a45aebf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

proposals/0376-function-back-deployment.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99

1010
## Introduction
1111

12+
This proposal introduces a `@backDeployed` attribute to allow ABI-stable libraries to extend the effective availability of their own public APIs to older OSes, where the API isn't actually present in the library that shipped with those OSes. While this resembles a polyfill mechanically, it does not help a module to overlay a polyfill on top of an API from another module.
13+
14+
## Motivation
15+
1216
Resilient Swift libraries, such as the ones present in the SDKs for Apple's platforms, are distributed as dynamic libraries. Authors of these libraries use `@available` annotations to indicate the operating system version that a declaration was introduced in. For example, suppose this were the interface of ToastKit, a library that is part of the toasterOS SDK:
1317

1418
```swift
@@ -126,8 +130,6 @@ extension Toaster {
126130
}
127131
```
128132

129-
Developers familiar with JavaScript may recognize these generated compatibility functions as [polyfills](https://remysharp.com/2010/10/08/what-is-a-polyfill).
130-
131133
When the deployment target of the client app is at least toasterOS 2.0, the compiler can eliminate the branch in `makeBatchOfToast_thunk(_:)` and therefore make `makeBatchOfToast_fallback(_:)` an unused function, which reduces the unnecessary bloat that could otherwise result from referencing a back deployed API.
132134

133135
### Restrictions on declarations that may be back deployed

0 commit comments

Comments
 (0)