It's not only a problem for ABI-stable libraries. It's really part of a larger goal to split visibility from conformance, which would allow all kinds of great enhancements like the ability to add requirements while retaining source stability. If you can't add a reasonable default, so just create something which traps, you lose conformance checking in your own types... and yeah, you might trap if somebody else conformed.
The standard library isn't really a great place to look, because it provides common-currency protocols like Collection
, Codable
and Numeric
, which are definitely designed for you to conform your own types to them. The same goes for Foundation; part of its goal is to provide a set of common interface types for everybody. They are really too low level for this to surface often - typically this will occur in higher-level libraries, where you want to hide implementation details behind an erased interface.
For the standard library specifically, it mostly comes down to implementation details. For example, you could rewrite the _Variant
storage enums with a private protocol. In theory it should be just as fast and require less code, but I think in practice the optimiser doesn't handle it as well (yet).