Yes, something like this could be implemented in the standard library for everyone to use. The issue right now is that we can’t add conformances to existing types now because we don’t have a way to backward deploy the conformances yet (adding CustomStringConvertible
to keypaths). See Backwards-deployable Conformances for details. Maybe there are other ways to make this accessible now that the standard library can expose?
While my library does do this, it makes use of a keypaths runtime layout which is considered private and could change in future Swift versions (as pointed out by Joe). The best case scenario is that this moves to the stdlib so that my library can stop relying on this runtime private information.