[Pitch] Runtime enumeration of custom sections

Thank you for the replies here. I have taken the advice to say what I want and how I would want it to work, and written a new pitch: Custom metadata attributes for types, and runtime access to custom sections.

It keeps what this thread proposed, runtime access to custom sections, now backed by the section index SE-0492 described and extended to COFF and Wasm. On top of it sits the thing I actually want: a marker attribute on types that the runtime can enumerate, written as a narrowed revision of SE-0385. The observation API and the idea of a kind in swift5_tests are dropped, for the reasons given here. The function takes a StaticString, returns UnsafeRawBufferPointer and is back-deployed, so a library with strict availability constraints can adopt it; a RawSpan form is listed as a future direction.

The section access is implemented, as a draft pull request to swiftlang/swift ([Runtime][IRGen][Sema] Emit and expose the SE-0492 custom section index by OlafAndreas · Pull Request #93419 · swiftlang/swift · GitHub), and swift-discovery runs on it with a ten-line change in place of swift-sections. The full proposal is on my fork: swift-evolution/proposals/NNNN-custom-type-metadata.md at olaf/custom-type-metadata · OlafAndreas/swift-evolution · GitHub

I would like to continue the conversation in the new thread.