4 ms·
> you still don't have the useful property that a and "aardvark" are equal That sounds more like a footgun to me. The blogpost slug "aardvark" and the username
by Nullabillity 6y ago
> you still don't have the useful property that a and "aardvark" are equal
That sounds more like a footgun to me. The blogpost slug "aardvark" and the username "aardvark" aren't equivalent. The type carries crucial semantic intent.
- kazinator 6y agoThere can easily be a form of equality substitution whereby the types of the original objects remain relevant for the purposes of the comparison. So that is to say, equal still demands some sort of type match on the original objects, and if that is satisfied, then it proceeds with the equality subs. Just, not in my language, thanks. Problem is, how exact of a match do we require? And the exact match is out of the question, too, since it ignores inheritance. If the blogpost slug is derived from username by inheritance, I might want them to be comparable. Thus left has to be a subtype of right, or vice versa. However, a key property of my object system is that it does not require inheritance for substitutability, you see. The programmer expectation is that they can write some new type from scratch which just has the right properties and methods to be used wherever some existing type is applicable, without inheriting from any common base. And "right properties and methods" includes the equal method for equality substitution.