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
+24-24Lines changed: 24 additions & 24 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
@@ -115,26 +115,26 @@ Questions about how to use Swift Numerics modules, or issues that are not clearl
115
115
116
116
## Notes
117
117
118
-
¹ 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 `import Numerics`, so this isn't an issue for them.
118
+
[^1]: 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