Re:Timsort, the Python sorting algorithm
by Dylan16807 on Wednesday October 09, 2019 @05:08PM
(#21208091)
How does that prevent you from accidentally making a.compare(b) and b.compare(a) inconsistent on some values?
Making sure you can compare the types is already happening in the compiler, and doesn't find the bug.
Is it? In Rust and other languages you would use trait bounds to restrict the input types to be comparable with each other, which would make this a compile time error.