As the author of the original pitch I think I should reiterate why we didn’t want to automatically inherit all conformances of the original type.
One of our motivating examples was Identifiers:
struct Person {
newtype Identifier = String
let id: Identifier
let name: String
}
Here, we don’t want Identifier to inherit almost any of the many features String has. We don’t want to concat two Identifiers, we don’t want to create a substring from an Identifier. None of those features make any sense.
In fact, the only thing we want from Identifier is Equatable, Hashable en perhaps CustomStringConvertable (but only for debugging).
So if newtype
automatically inherits all the behaviours of the original type, it would make it less useful for me, because now I can no longer use it for Identifiers.
Additionally, it would be really nice to optionally request to inherit (forward) existing behaviour. In cases where it is needed, like in a lot of Int/Float examples.