[Pitch #2] Add `isKnownIdentical` Method for Quick Comparisons to `Equatable`

My misgivings about linking "identicality" to equality is that two elements can be considered equal while still containing a payload that makes them non-identical. And two elements can be identical but non-equal (anything containing NaN values). By putting them both inside Equatable you end up with the view that identity is strictly a shortcut for equality (which is true in many cases, but not all).

So if the goal is to detect whether a new value is identical to a previous one to save processing time, I think this should be done without involving equality. I still believe my suggestion from an earlier pitch would be best: a bitwise comparaison by default (with an optional cap on byte count) and a CustomKnownIdenticalComparable protocol for types that needs to customize the behavior. This makes "identical" a concept unburdened by the contradictions of "equal".

3 Likes