I would love one day to make a huge breaking change and implement Universal Equality and Hashability:
- Provide global
func ==<T>(lhs: T, rhs: T)
handling any type, including meta types, tuples, existential containers and functions. Similar for hashing. - Move equality and hashability witness to VWT.
- Replace
Equatable
/Hashable
withCustomEquatable
/CustomHashable
similar toCustomStringConvertible
andCustomReflectable
. - Drop
===
and use==
to compare references. Disallow classes to conform toCustomEquatable
/CustomHashable
.
Reasoning for the last one - if reference equality is not what you need, then your entity should not be modeled as a reference type, but rather a value type that uses heap allocation as its implementation detail.
EDIT:
- And it also requires stable weak reference - currently references to zombie side tables are dropped during copying.