3 ms·
Interesting read, but I think the first part would benefit from a detour toward interfaces, why they are not good enough to solve the sort problem, and how cont
by tgirod 8y ago
Interesting read, but I think the first part would benefit from a detour toward interfaces, why they are not good enough to solve the sort problem, and how contracts can help.
IIRC it is along those lines :
You could define a `Lesser` interface with a method `Less(Lesser) bool`, and implement this interface on what you want to sort, but then you would have no way to assert at compile time that x and y are of the same type in `x.Less(y)`.
As I understand them, contracts allow you to assert things like this.