I'm not sure what your point is; mine was that sort is expected to be stable, which means that reversing $a and $b and reversing the return of sort will produce opposite orders for elements that compare as equal by the compare function. I used overload to demonstrate that this holds even when the two elements have the same string and numeric value. Making the elements take varying numeric values doesn't seem to me to be at all related.