2 ms·
> I am pretty sure System.Type is partially implemented via unsafe code. Metadata discovery can be done with safe code, it is stored in the PE (on disk). Cecil
by zamalek 8y ago
> I am pretty sure System.Type is partially implemented via unsafe code.
Metadata discovery can be done with safe code, it is stored in the PE (on disk). Cecil is a good example of this in action.
Execution of reflected entities is done with runtime intrinsics. Strictly speaking it is unsafe code (as it is written in C/++), but it isn't roped in by any usual means.
Skimming over this article shows that Swift reflection is, effectively, an interface implemented by every object. While the automagic dynamic reflection sounds cool, my alarm bells are ringing because a huge amount of useful tooling needs static bindings. It's one of those cool ideas that is better left unimplemented: it's far more reliable to write a utility library to do this.