You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+43-28Lines changed: 43 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ These modules fall broadly into two categories:
11
11
There is some overlap between these two categories, and an API that begins in the first category may migrate into the second as it matures and new uses are discovered.
12
12
13
13
Swift Numerics modules are fine-grained.
14
-
For example, if you need support for Complex numbers, you can import ComplexModule¹ as a standalone module:
14
+
For example, if you need support for Complex numbers, you can import ComplexModule[^1] as a standalone module:
15
15
16
16
```swift
17
17
importComplexModule
@@ -42,7 +42,7 @@ To use Swift Numerics in a SwiftPM project:
42
42
1. Add the following line to the dependencies in your `Package.swift` file:
2. Add `Numerics` as a dependency for your target:
@@ -56,6 +56,22 @@ To use Swift Numerics in a SwiftPM project:
56
56
57
57
3. Add `import Numerics` in your source code.
58
58
59
+
## Source stability
60
+
61
+
The Swift Numerics package is source stable; version numbers follow [Semantic Versioning](https://semver.org).
62
+
The public API of the `swift-numerics` package consists of non-underscored declarations that are marked either `public` or `usableFromInline` in modules re-exported by the top-level `Numerics` module, *excepting any API that involves a conformance to Differentiable (because Differentiable itself is not stable in Swift)*.
63
+
Interfaces that aren't part of the public API may continue to change in any release, including patch releases.
64
+
65
+
Note that contents of the `_NumericsShims` and `_TestSupport` modules, as well as contents of the `Tests` directory, explicitly are not public API.
66
+
The definitions therein may therefore change at whim, and the entire module may be removed in any new release.
67
+
If you have a use case that requires underscored operations, please raise an issue to request that they be made public API.
68
+
69
+
Future minor versions of the package may introduce changes to these rules as needed.
70
+
71
+
We'd like this package to quickly embrace Swift language and toolchain improvements that are relevant to its mandate.
72
+
Accordingly, from time to time, we expect that new versions of this package will require clients to upgrade to a more recent Swift toolchain release.
73
+
Requiring a new Swift release will only require a minor version bump.
74
+
59
75
## Contributing to Swift Numerics
60
76
61
77
Swift Numerics is a standalone library that is separate from the core Swift project, but it will sometimes act as a staging ground for APIs that will later be incorporated into the Swift Standard Library.
@@ -89,7 +105,8 @@ Questions about how to use Swift Numerics modules, or issues that are not clearl
¹ Swift is currently unable to use the fully-qualified name for types when a type and module have the same name (discussion here: https://forums.swift.org/t/pitch-fully-qualified-name-syntax/28482).
104
-
This would prevent users of Swift Numerics who don't need generic types from doing things such as:
105
-
106
-
```swift
107
-
importComplex
108
-
// I know I only ever want Complex<Double>, so I shouldn't need the generic parameter.
109
-
typealiasComplex= Complex.Complex<Double> // This doesn't work, because name lookup fails.
110
-
```
111
-
112
-
For this reason, modules that would have this ambiguity are suffixed with `Module` within Swift Numerics:
113
-
114
-
```swift
115
-
importComplexModule
116
-
// I know I only ever want Complex<Double>, so I shouldn't need the generic parameter.
117
-
typealiasComplex= ComplexModule.Complex<Double>
118
-
// But I can still refer to the generic type by qualifying the name if I need it occasionally:
119
-
let a = ComplexModule.Complex<Float>
120
-
```
121
-
122
-
The `Real` module does not contain a `Real` type, but does contain a `Real` protocol.
123
-
Users may want to define their own `Real` type (and possibly re-export the `Real` module)--that is why the suffix is also applied there.
124
-
New modules have to evaluate this decision carefully, but can err on the side of adding the suffix.
125
-
It's expected that most users will simply `import Numerics`, so this isn't an issue for them.
118
+
[^1]: The module is named `ComplexModule` instead of `Complex` because Swift is currently unable to use the fully-qualified name for types when a type and module have the same name (discussion here: https://forums.swift.org/t/pitch-fully-qualified-name-syntax/28482).
119
+
This would prevent users of Swift Numerics who don't need generic types from doing things such as:
120
+
121
+
```swift
122
+
importComplex
123
+
// I know I only ever want Complex<Double>, so I shouldn't need the generic parameter.
124
+
typealiasComplex= Complex.Complex<Double> // This doesn't work, because name lookup fails.
125
+
```
126
+
127
+
For this reason, modules that would have this ambiguity are suffixed with `Module` within Swift Numerics:
128
+
129
+
```swift
130
+
importComplexModule
131
+
// I know I only ever want Complex<Double>, so I shouldn't need the generic parameter.
132
+
typealiasComplex= ComplexModule.Complex<Double>
133
+
// But I can still refer to the generic type by qualifying the name if I need it occasionally:
134
+
let a = ComplexModule.Complex<Float>
135
+
```
136
+
137
+
The `Real` module does not contain a `Real` type, but does contain a `Real` protocol.
138
+
Users may want to define their own `Real` type (and possibly re-export the `Real` module)--that is why the suffix is also applied there.
139
+
New modules have to evaluate this decision carefully, but can err on the side of adding the suffix.
140
+
It's expected that most users will simply `importNumerics`, so this isn't an issue for them.
0 commit comments