Or it could probably be solved by not providing isKnownIdentical
for non copyable types or always returning nil / false for those.
I see. nil
would be quite painful for optimisations like these, for such algorithms it would be better if such types were not conforming to the protocol in the first place, but I guess this is not on the table if isIdentical is coupled with Equatable.
BTW, what happens with this type with your proposal:
struct Storage: Equatable {
var items: [String]
var count: Int
}
Would the default autogenerated isKnownIdentical
of Storage
be returning nil
because one of its members says nil
?
It's also not clear what Array<Something>
should do when Something has a custom isKnownIdentical
that returns false or nil. Or is it ok to have one Array identical to another even when its members are not?