This thread has convinced my that Typed Arrays should be born extensible. Actually, my subclass example in the thread started me down that path. In many cases where you might subclass an array you will want to add per instance state. You can expose a getter/setter on the prototype but the state still needs to be associated with the individual instances. Expando properties (or even better properties added in the @@create method) are the most natural way to represent that state.
The Firefox implementors will make this change if it represents TC39 consensus. I'll put this item on the agenda for the next meeting and see if we can agree on extensible Typed Arrays. Allen On Aug 28, 2013, at 11:01 PM, Filip Pizlo wrote: > Here's the part that gets me, though: what is the value of disallowing named > properties on typed arrays? Who does this help? > > I don't quite buy that this helps users; most of the objects in your program > are going to allow custom properties to be added at any point. That's kind > of the whole point of programming in a dynamic language. So having one type > where it's disallowed doesn't help to clarify thinking. > > I also don't buy that it makes anything more efficient. We only incur > overhead from named properties if you actually add named properties to a > typed array, and in that case we incur roughly the overhead you'd expect > (those named properties are a touch slower than named properties on normal > objects, and you obviously need to allocate some extra space to store those > named properties). > > -Filip > > > > On Aug 28, 2013, at 10:52 PM, Steve Fink <[email protected]> wrote: > >> On 08/27/2013 09:35 AM, Oliver Hunt wrote: >>> My complaint is that this appears to be removing functionality that has >>> been present in the majority of shipping TA implementations, assuming from >>> LH's comment that Chakra supports expandos. >> >> Note that even in the engines that support expandos, they will probably >> not survive a structured clone. I just tried in Chrome and they get >> stripped off. This further limits their utility in today's Web. >> _______________________________________________ >> es-discuss mailing list >> [email protected] >> https://mail.mozilla.org/listinfo/es-discuss > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

