equalsverifier/CHANGELOG.md at main · jqno/equalsverifier

EqualsVerifier can be used in Java unit tests to verify whether the contract for the equals and hashCode methods is met. - jqno/equalsverifier

GitHub

@ethauvin

“Look what they need to mimic a fraction of our power.” —the Eq and Hash derives in #Rust

@argv_minus_one @ethauvin That is, if you ignore the gaping hole that is Eq/Hash/Ord for floating point values in Rust.

I prefer my data structures to work correctly and reliably, so Java has the upper hand in that regard.

@soc

Wait, what happens with Eq/Hash/Ord for floats in Rust?

@ethauvin

@argv_minus_one @ethauvin They didn't read the IEEE754 spec, and instead decided (based on folklore apparently) that floats cannot implement these traits.

It turned out that following through with this mistake was too cumbersome, so now Rust has *some* data structures that can store floats, but not reliably retrieve them, and *some* data structures that do not support floats at all.

#rust

@soc @argv_minus_one @ethauvin
Isn't that what the partial variants are for? How would you implement Eq for NaN when NaN!=NaN ?

@tpoliaw @argv_minus_one @ethauvin Eq being "just a marker trait" under PartialEq is a big part of the problem:

It only allows for one implementation, where two free-standing traits would be more in tune with the spec and work much better in practice.