Re:Everybody makes mistakes when writing comparison functions
by choeger on Thursday September 09, 2021 @07:26AM
(#28468500)
I think comparison functions are a prime "use case" for this kind of error because it will pass the type check easily and comparison is often somewhat symmetric, so you will do a lot of copy and paste. Only unit or property tests could catch this (and a compiler warning, of course). The example here is of course extreme, but I bet you will find something like this quite often, especially in OO code like Java.
[ Parent
| on HN ]
There are no comments on this comment yet.