Comment #44 on issue 164 by atcrabtree: Wrong order in Object properties interation
http://code.google.com/p/v8/issues/detail?id=164
After stumbling upon what is clearly evolved into a somewhat ridiculous standoff, I think it's pretty obvious the bias each side is arguing from.
Those in favor of Chrome's implementation see objects as, well... objects. Similar to an object in any other language. Thus since no developer expects object property iteration order to be maintained, they find it ludicrous that developers here would request it.
HOWEVER, it is also equally obvious and quite ridiculous that they do not realize that those against the current implementation are so because these see JavaScript objects as a de facto associative array, certainly the single most common use for an object literal.
My language background is limited to PHP, C, C++, Java and JS, but having worked regularly with PHP associative arrays, I can safely say they are a pleasure to work with. Sorting based on keys and iterating based on the order they were added adds a great deal of functionality to the language. Which is why when I discovered this bug in my node.js API implementation, I was somewhat flabbergasted to see the resistance to adding support for this.
I get that this might not be easy, that I won't be the one doing it, and that there are plenty of excuses for NOT implementing this feature, but this only WorksAsIntended because those implementing refuse to admit the great benefit doing so would be to the language / engine. If this discussion is about the merits of and whether or not it is best to maintain ordering in Object objects, to me it is fairly difficult to defend that it would not be vastly superior from a language standpoint.
From a performance standpoint, I'm curious what the actual numbers would be and would add that with so many users using objects as associative arrays and likely coming from PHP or another language where ordering is preserved, the benefit of adding this to mitigate "least surprise" would likely outweigh any performance hits.
Or is everyone arguing purely out of imaginary #s? -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
