3 ms·
The whole point is that equality should have nothing to do with comparing references. Your comment is just making the author's point. References, cycles, mutab
by dudul 6y ago
The whole point is that equality should have nothing to do with comparing references.
Your comment is just making the author's point. References, cycles, mutable state these just make it harder to reason about your code.
And a nice petty little zing at the end for good measure. Good job.
- tsimionescu 6y agoThe point they raise is valid, though the tone is lacking. If you want to define a graph data structure, cycles are inherent, so there must be some way to deal with them - they are not something that can simply be ignored. This is a completely practical problem, and identity instead of value equality is a valid answer. Of course, this doesn't contradict the original article: reference equality can still exist in the language, it just helps if it's not the default. For example, in Common Lisp you have both `eq` (reference equality) and `equal` (typed value equality) [and even the somewhat stranger `equalp` (structural equality, e.g. (equalp '(1 2) '(1 2)) -> true)].