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: proposals/0492-section-control.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -92,7 +92,7 @@ Different object file formats (ELF, Mach-O, COFF) have different restrictions an
92
92
93
93
```swift
94
94
#if objectFileFormat(ELF)
95
-
@section(".mysection")
95
+
@section("mysection")
96
96
#elseif objectFileFormat(MachO)
97
97
@section("__DATA,mysection")
98
98
#endif
@@ -190,19 +190,19 @@ The effects described above are applied to the storage symbols and don’t gener
190
190
191
191
### Constant expressions
192
192
193
-
Swift currently does not have a formal notion of a **constant expression**, i.e. an expression with a syntactic form that *guarantees the ability to know it's value at compile-time*. This proposal provides a definition of a "bare minimum" constant expression, with the understanding that this does not cover the language needs in generality, and the expectation that the Swift compiler and language will keep expanding the allowed forms of constant expressions. See [Generalized constant values and expressions](#generalized-constant-values-and-expressions) in Future Directions for further discussion on this.
193
+
Swift currently does not have a formal notion of a **constant expression**, i.e. an expression with a syntactic form that *guarantees the ability to know it's value at compile-time*. This proposal provides a definition of a "bare minimum" constant expression, with the understanding that this does not cover the language needs in generality, and with the expectation that the Swift compiler and language will keep expanding the allowed forms of constant expressions in the future. See [Generalized constant values and expressions](#generalized-constant-values-and-expressions) in Future Directions for further discussion on this.
194
194
195
195
This proposal defines a **constant expression** as being one of:
196
196
197
-
- an integer literal using any of built-in integer types (Int, UInt, Int8/16/32/64/128, UInt8/16/32/64/128)
197
+
- an integer literal using any of standard integer types (Int, UInt, Int8/16/32/64/128, UInt8/16/32/64/128)
198
198
- a floating-point literal of type Float or Double
199
199
- a boolean literal of type Bool
200
200
- a direct reference to a non-generic function using its name (the function itself is not generic, and also it must not be defined in a generic context)
201
201
- a direct reference to a non-generic metatype using the type name directly (the type itself is not generic, and also it must not be defined in a generic context), where the type is non-resilient
202
202
- a tuple composed of only other constant expressions
203
203
- an array literal of type InlineArray composed of only other constant expressions
204
204
205
-
Explicitly, this definition currently does **not allow** any operators, using any user-defined named types, any other built-in type (e.g. strings, dictionaries, sets), using closures, or referencing any variables by name. See below for examples of valid and invalid constant expressions:
205
+
Explicitly, this definition currently does **not allow** any operators, using any user-defined named types, any other standard type (e.g. strings, dictionaries, sets), using closures, or referencing any variables by name. See below for examples of valid and invalid constant expressions:
206
206
207
207
```swift
208
208
@section("...") let a =42// ✅
@@ -211,7 +211,7 @@ Explicitly, this definition currently does **not allow** any operators, using an
211
211
@section("...") let d =Int.max// ❌ not a literal
212
212
@section("...") let e: UInt8=42// ✅
213
213
@section("...") let f =UInt8(42) // ❌ not a literal
214
-
@section("...") let g: MyCustomExpressibleByIntegerLiteral =42// ❌ not a built-in type
214
+
@section("...") let g: MyCustomExpressibleByIntegerLiteral =42// ❌ not a standard type
0 commit comments