soc.me · Oct 31, 2017
Language Design: Equality & Identity – Part 2: Problems
0Sign in to vote or save
This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.
Containment The core issue is that equality on its own is insufficient to implement some, rather mundane, algorithms. Asking the simple question “is some element contained in this data structure” in different languages demonstrates the problem: Java: List.of(Float.NaN).contains(Float.NaN); // true JavaScript: [NaN].includes(NaN) // true Rust: &[0.0/0.0].contains(0.0/0.0) // false C#:…
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.