3 ms·
I suppose it could, but the point of the object being defined as an unordered collection is because the most straight-forward way of implementing this is throug
by treerex 13y ago
I suppose it could, but the point of the object being defined as an unordered collection is because the most straight-forward way of implementing this is through a hash table, where the order of the keys cannot be guaranteed without additional work. I'm sure they didn't consider a parser randomly permuting the lexical order of the pairs as something a sane person would do.
- ygra 13y agoGranted, hosay123's comment [982] is much more valid, though. [982] https://news.ycombinator.com/item?id=6147084 https://news.ycombinator.com/item?id=6147084
- IanCal 13y agoWell it could perfectly sensibly do this: if not key in hash: hash[key] = value That's a sensible approach, valid as per the spec. > I'm sure they didn't consider a parser randomly permuting the lexical order of the pairs as something a sane person would do. It could sort the keys, in which case the order is no longer guaranteed (again this doesn't seem insane). The proposal is to rely on undefined behaviour for comments. I'm amazed we're still talking about this.