2 ms·
> If the documentation for this function went on along the lines of "we discourage the use of 3 way compares as we consider it an antipattern, do X instead, the
by kubanczyk 4y ago
> If the documentation for this function went on along the lines of "we discourage the use of 3 way compares as we consider it an antipattern, do X instead, there's literally no reason to ever use 3 way compares, we know it, here's why..." maybe, but it doesn't.
But it does. It literally says "It is usually clearer and always faster to use the built-in string comparison" and it always said that.
https://pkg.go.dev/strings@go1.5#Compare https://pkg.go.dev/strings@go1.5#Compare
https://pkg.go.dev/strings@go1.19.2#Compare https://pkg.go.dev/strings@go1.19.2#Compare
The entire documentation for this function is four short sentences. If my code editor didn't make it easy and natural to see them, I'd rethink my shit right now.
- quelltext 4y agoIt doesn't go into why, it's just a statement.