|
|
|
|
|
by aric
3866 days ago
|
|
1. I don't see how. 2. Impure? 3. That's the point. It's to force people to stop using maps as if they're sorted. 4. Why would you want to rely on the arbitrary nature of a hash table for order? 5. That's the best type of boilerplate. It's short. It brings clarity. You might not need custom sort functions. The sort package supports basic types, which you'd use if you're keeping track of an index with []int for instance. https://golang.org/pkg/sort/ |
|
Disclaimer: I've never used this feature myself and I sympathize with the desire on the part of the Go designers to avoid accidental de facto stabilization of hash table iteration order--though it sounds like it could have been done without drawbacks by randomizing at process start.