iteration order for Object
brendan at mozilla.com
Sun Mar 13 14:07:02 PDT 2011
On Mar 13, 2011, at 3:58 PM, Charles Kendrick wrote:
> Brendan, Bradley and others - there's no need to search for a relatively uncommon use case for ordered maps indexed by keys - a far more common use case is enumerated data stored numerically, eg, marital status:
> 2: "Married",
> 1: "Single",
> 5: "Divorced"
It's still a synthetic example, and real web sites/apps would be more compelling and helpful for forge consensus.
> Likewise maps from numeric primary key values to display values for the records.
Too assert-y, sorry. I'm on your side at this point (see my reply to Claus, just sent). But evidence trumps assertions or suppositions, however plausible.
No offense. In my reply to Claus I said developers' eyes glaze over at LinkedHashMap. I'm not putting anyone down, on any side of this. JS's objects often "DWIM" and this is a strength as well as a weakness. It's hard to say it is purely a bug, IM(truly Humble, I hope, due to feeling developer pain these almost-16 years)O.
> So we're looking at standardizing a behavior for Object that no one has ever felt the need to implement as a reusable component.
> I would argue this means we're standardizing a very rare use case.
It may be rare; it's hard to measure frequency of use (static or more imp. dynamic use). This indexed-first-in-indexed-order idea has come from implementations, I think. The implementors may be reacting to user demands too, but the optimization wins carry weight and may be dominant.
This could indeed be the wrong way to evolve the spec.
More information about the es-discuss