Current:
extension Foo: Defaults.Serializable, Defaults.PreferRawRepresentable {}
I think this may be better:
extension Foo: Defaults.Serializable.RawRepresentable {}
This is shorter, but more importantly, it makes the choice explicit. Users should prefer this over Defaults.Serializable. Defaults.Serializable has a big flaw. For example, you have a struct X: Codable, Defaults.Serializable. You save data with it, but later on, you add a RawRepresentable conformance. The previous persisted version of the struct can no longer be loaded as it's saved using the Codable bridge, but now tries to load using the RawRepresentable bridge.
// @hank121314 Thoughts? Any better way to prevent this problem?
Current:
I think this may be better:
This is shorter, but more importantly, it makes the choice explicit. Users should prefer this over
Defaults.Serializable.Defaults.Serializablehas a big flaw. For example, you have astruct X: Codable, Defaults.Serializable. You save data with it, but later on, you add aRawRepresentableconformance. The previous persisted version of the struct can no longer be loaded as it's saved using theCodablebridge, but now tries to load using theRawRepresentablebridge.// @hank121314 Thoughts? Any better way to prevent this problem?