There exists a long-standing prior art in Standard Library that "equal" representations are not always "identical-indistinguishable" representations:
This has shipped for years in Standard Library. There does not seem to ever have been any big controversy about this… but if you have the opportunity to volunteer with more research please respond back if you find out any interesting details about the evolution of SetAlgebra that might help us here.
Before I get too far in the weeds with this answer… it might be helpful to slow down and also review some goals with the proposal:
Primary: Our most important goal is to define a set of isIdentical(to:) methods on concrete types. This means that every type in this proposal should be ready to define its public semantics and guarantees so that library maintainers can then build impactful implementations.
Secondary: A less important goal is to define an "abstract" set of "informal" guidelines that are not only an umbrella blanket over the concrete types in this proposal but might also cover future concrete types in Standard Library — and any library — that attempts to add isIdentical(to:).
Tertiary: A "nice to have" goal is to then attempt and "backdeploy" that abstract set of guidelines to existing types like Span that already shipped isIdentical(to:)before this proposal.
So if we want to have a discussion about what "is identical" really means… it might be helpful then to slow down if we are attempting to go too far down the road of an "abstract" protocol definition that we expect all future concrete types to adopt. That is not — and should not be — a primary goal of this proposal.
But if we did want to discuss some more abstract concepts behind these ideas I collected some more thoughts here that might help:
I briefly thought about putting this down as an "appendix" on the proposal… but I don't feel like I have strong enough opinions to attempt to codify this all down to some kind of "canon" treatise that would then serve as a prior art for future proposals. But in general my thoughts here so far are:
Copies are representations that are "identical-indistinguishable".
Copies are representations that the compiler can be free to insert or remove on your behalf with zero expected changes on the surface meaning of your program.[1]
Representations that are "identical-indistinguishable" are "interchangeable-substitutable".
Representations that are "identical-indistinguishable" are not necessarily copies.
Representations that are "interchangeable-substitutable" produce the same behavior in a program or algorithm that depends on the value properties of this representation. This does not include object identity or any other public state that is not considered as part of the public value.
Representations that are "interchangeable-substitutable" are not necessarily "identical-indistinguishable".
This possible missing piece here so far for me is to what extent we can attempt to define what it means to "be identical" as a "weaker" guarantee than what it means to be "a copy". But again… this all should not be a primary goal of this proposal. Our primary goal should be to define the semantics and guarantees of isIdentical(to:)on concrete types. We feel the existing proposed header doc comments are strong enough promises to make for an impactful API and I am not yet persuaded to change my opinion about that.
We are not considering exposing identity at this time. A potential future direction that exposes identity should not block this existing proposal from shipping. Here are some more thoughts on that: