Skip to content

Commit 218a122

Browse files
committed
added acknowledgments section
1 parent 91dec07 commit 218a122

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ If the presence of reflection metadata is mandatory, the requirement on Reflecta
130130
Since Reflection metadata might be used by the debugger, we propose to always keep that metadata if full emission of debugging information is enabled (`-gdwarf-types` or `-g` flags).
131131

132132
### Changes in flags
133+
133134
To handle behavior change between Swift pre-6 and 6, we can introduce a new upcoming feature, which will allow to enable Opt-In mode explicitly for pre-6 Swift with `-enable-upcoming-feature OptInReflection` and will set this mode by default in Swift 6.
134135

135136
A new flag `-enable-full-reflection-metadata` will also have to be introduced to allow developers to enable reflection in full if they desire in Swift 6 and later.
@@ -154,6 +155,7 @@ For Swift 6, flags `-disable-reflection-metadata` and `-emit-reflection-for-debu
154155
Introducing a new flag to control the feature will allow us to safely roll it out and avoid breakages of the existing code. For those modules that get compiled with fully enabled metadata, nothing will change (all symbols will stay present). For modules that have the metadata disabled, but are consumers of reflectable API, the compiler will emit the error enforcing the guarantee.
155156

156157
### Casts implementation
158+
157159
Casting might be a good way to improve the feature's ergonomics because currently there is no way to check if reflection is available at runtime. (`Mirror.children.count` doesn't really help because it doesn't distinguish between the absence of reflection metadata and the absence of fields on a type)
158160

159161
To implement this feature, we propose to introduce a new runtime function `swift_reflectableCast`, and emit a call to it instead of `swift_dynamicCast`during IRGen if Reflectable is a target type.
@@ -195,4 +197,9 @@ Dead Code Elimination and linker optimisations were also considered as a way to
195197
The optimiser could use a conformance to a `Reflectable` protocol as a hint about what reflection metadata should be preserved.
196198
However, turned out it was quite challenging to statically determine all usages of Reflection metadata even with hints.
197199

198-
It was also considered to use an attribute `@reflectable` on nominal type declaration to express the requirement to have reflection metadata, however, a lot of logic had to be re-implemented outside of type-checker to ensure all guarantees are fulfilled.
200+
It was also considered to use an attribute `@reflectable` on nominal type declaration to express the requirement to have reflection metadata, however, a lot of logic had to be re-implemented outside of type-checker to ensure all guarantees are fulfilled.
201+
202+
203+
## Acknowledgments
204+
205+
Thanks to [Joe Groff](https://github.com/jckarter) for various useful pieces of advice, general help along the journey, and for suggesting several useful features like Reflectable casts!

0 commit comments

Comments
 (0)