Skip to content

Commit 0173bfc

Browse files
authored
Merge pull request #1859 from maxovtsin/NNNN-opt-in-reflection-metadata
[SE-0379][Opt-In Reflection] Minor syntactical changes
2 parents 9d84a58 + 943252d commit 0173bfc

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
@@ -28,11 +28,11 @@ Currently, there is no way to selectively enable the emission of reflectable met
2828
Moreover, compiler's flags exist that allow to completely disable emission.
2929

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

3434
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.
35-
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.
35+
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.
3636

3737
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.
3838
Others, like SwiftUI, rely on it and won't work correctly if the reflection metadata is missing.
@@ -131,7 +131,7 @@ Library authors will have to prepare their APIs for Swift 6 and introduce generi
131131
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.
132132

133133

134-
### Stdlib behavior changes
134+
### No stdlib behavior changes
135135

136136
In Swift `Mirror(reflecting:)` is the only official way to access Reflection metadata, all other APIs are using it under the hood.
137137
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)