Skip to content

Commit 943252d

Browse files
committed
opt-in reflection minor syntactical changes
1 parent 7ebb59f commit 943252d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

proposals/0379-opt-in-reflection-metadata.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ Currently, there is no way to selectively enable the emission of reflectable met
3030
Moreover, compiler's flags exist that allow to completely disable emission.
3131

3232
A developer has two ways right now - either
33-
1. To just in case enable Reflection in full.
34-
2. To try to guess which used APIs consume Reflection, and enable it only for modules that are users of such APIs.
33+
1. To enable Reflection in full just in case.
34+
2. To try to guess which used APIs consume Reflection, and enable it only for modules that use such APIs.
3535

3636
Both of those options have flaws. The first one leads to excessive contribution of reflection metadata to binary size and might affects the secrecy of generated code.
37-
The second one isn't safe because many APIs are black boxes if the guess is wrong, an app might behave not as expected at runtime.
37+
The second one isn't safe because many APIs are black boxes. If the developer's guess is wrong, an app might behave not as expected at runtime.
3838

3939
Furthermore, APIs can use Reflection Metadata differently. Some like `print`, `debugPrint`, and `dump` will still work with disabled reflection, but the output will be limited.
4040
Others, like SwiftUI, rely on it and won't work correctly if the reflection metadata is missing.
@@ -133,7 +133,7 @@ Library authors will have to prepare their APIs for Swift 6 and introduce generi
133133
We also propose to deprecate the compiler's options that can lead to missing reflection - `-reflection-metadata-for-debugger-only` and `-disable-reflection-metadata` and starting with Swift 6, ignore these arguments in favor of the default opt-in mode.
134134

135135

136-
### Stdlib behavior changes
136+
### No stdlib behavior changes
137137

138138
In Swift `Mirror(reflecting:)` is the only official way to access Reflection metadata, all other APIs are using it under the hood.
139139
We intentionally do not propose adding a Reflectable constraint on Mirror type, because it would impose restrictions on those developers who still don't want to require it and consume Reflection optionally.

0 commit comments

Comments
 (0)