Comment #31 on issue 164 by timdown: Wrong order in Object properties
interation
http://code.google.com/p/v8/issues/detail?id=164
Charles Kendrick, you seem to have deliberately chosen an insane format for
providing options to a function that sets options in a drop-down list in
order to illustrate your point with an absurd example. A more reasonable
and readable way would be:
selectControl.setOptions([
{value: "storedValue1", text: "displayValue1"},
{value: "storedValue2", text: "displayValue2"},
{value: "storedValue3", text: "displayValue3"}
]);
If that's too many characters for you, you could use an array of arrays,
though at the expense of some clarity:
selectControl.setOptions([
["storedValue1", "displayValue1"],
["storedValue2", "displayValue2"],
["storedValue3", "displayValue3"]
]);
Your point about doubling the number of objects for the garbage collector
to worry about still stands, but your other two objections are not valid
for either of the examples above. There is another, somewhat tangential
point here, which is that an option in a select list doesn't solely consist
of a value and text: it may also be selected, which requires more than just
an object property containing a string. More importantly, object properties
simply aren't ordered in ECMAScript and never have been. I don't how many
more times it needs to be said.
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev