2 ms·
You agree it should be explicit. But notice that explicit hash equality is just hashing followed by structural equality. Considering different abstraction leve
by jstimpfle 10y ago
You agree it should be explicit. But notice that explicit hash equality is just hashing followed by structural equality.
Considering different abstraction levels like AST or memory layout: This is moving up and down the levels of abstraction. It's conventional wisdom that you shouldn't do this in a single context (like a function, module, or even a programming language). But it's a good point - powerful languages like C present all these levels at once. In other words, there is often an impedance mismatch. Structural equality might be not quite the same to the compiler and to the programmer.
- Retra 10y agoAnd structural equality is just a special (also arbitrary) kind of hash equality. You still have to specify what kind of structure you're comparing. The "structural equality" that you are referring to is vague not uniquely determined.
- jstimpfle 10y agoYou made great points, and I've realized that the compiler/interpreter doesn't always know what's the part of the context that we are actually interested in. There's often too much context available and it's not always easy to throw away the information that we're not interested in. However when one does manage to make a function to a structural representation that contains exactly the interesting things, then equality is this function followed by structural equality.