4 ms·
I'd love to see the results of mandating a random order dict impl at an actual company/org (but hate to be forced to participate). Hopefully you hired developer
by not_kurt_godel 1y ago
I'd love to see the results of mandating a random order dict impl at an actual company/org (but hate to be forced to participate). Hopefully you hired developers who really like to write sorting algos.
- yxhuvud 1y agoWell, that is how hash tables in go works, so you'd not have to look that far.
- not_kurt_godel 1y agoGreat. Maybe GP will go a step farther and also mandate arrays that return elements in random order too. Relying on insertion order for any reason is for weaklings.
- tasty_freeze 1y agoPerl since 5.8.something has had the option of perturbing the hash function, so it is different from run to run. You can also set the set to a given value in order to lock in the sequence. In any case, it is not ordered. If you want that, you have to explicitly sort the keys of the hash.
- nielsbot 1y agoSwift (heavily used by Apple) has randomly ordered dictionaries for security: > In particular, random seeding enables better protection against (accidental or deliberate) hash-flooding attacks https://forums.swift.org/t/psa-the-stdlib-now-uses-randomly-seeded-hash-values/10789 https://forums.swift.org/t/psa-the-stdlib-now-uses-randomly-...
- not_kurt_godel 1y agoPerhaps not unrelated to why Python is the #1 most popular language while Swift is #22 https://www.tiobe.com/tiobe-index/ https://www.tiobe.com/tiobe-index/
- nielsbot 1y agoSwift isn’t popular because its Dictionary type uses randomly ordered keys?
- cyanydeez 1y agoProbably the inference is YAGNI .
- not_kurt_godel 1y agoIt certainly could be a reason among many. Just look at the thread GP shared, containing multiple years' worth of users voicing frustration at the introduction of this behavior.