Can an Array have array indexed accessor properties and other curiosities??
Allen.Wirfs-Brock at microsoft.com
Sun Feb 15 12:14:06 PST 2009
>From: Brendan Eich [mailto:brendan at mozilla.com]
>Sent: Sunday, February 15, 2009 10:43 AM
>>> What happens, if the [[DefineOwnProperty]] is used to create an
>>> property of an array instance whose name is an array index. I've
>>> thought of
>>> three possibilities:
>Implementations want 3, so do users. SpiderMonkey js shell sessions:
>Existing practice favors 3 over 1. That's decisive in my opinion
>(getters and setters are a de-facto standard ES3.1 is codifying and
It would be nice to have some concrete examples to backup the assertions in the first quote above. Does anyone know of actual use cases or concrete examples where users have exploited this capability in interesting ways. Similarly, can we be more concrete about why implementers would favor #3 (other than that it would make it easier for existing implementations that already do #3 to support ES3.1. That is a reasonable consideration what I acknowledge). I can think of assorted ways that #1 might benefit implementers who are interested in various optimizations of arrays. It's less obvious to me that #1 would be detrimental to implementations and #3 would be beneficial.
It great that we have existing practice to draw upon. We also have some wiggle room to depart from existing practice if we believe that would be beneficial. It would be nice if there was some strong evidence based upon actual experience that pointed one way or another.
>(Plea for A/B/C after different 1/2/3 numbered list style!)
Agreed, I've learned my lesson about having multiple ambiguously numbered listed in one message.
>So (reading ahead one message) I join Mark in agreeing with Breton's
>followup proposal, or amendment to the second #1 (if you know what I
Seems, OK to me although I'm not 100% sold that throwing in strict mode makes sense in this situation.
BTW, this week's Wiki draft will reflect my original suggestions as Pratap is already working on preparing it for Wiki publication. We'll update next week's draft to reflect whatever wise decided here.
More information about the Es-discuss