On Sep 29, 2012, at 4:20 PM, Yusuke Suzuki wrote:
> Thanks for your reply.
>
> Why did I do this? Because, we are defining a significant number new
> built-in "classes" and it is going to be increasingly hard to define
> meaningful instance state for all such prototypes. It is also arguably
> undesirable for most of these prototypes. Does any really think it is a good
> idea for Map.prototype to be globally available storage bin into which
> anybody can store and retrieve key/value pairs? Finally, note that the
> prototype objects created by ES6 class declarations typically are not valid
> instances of the class. Programmers would have to go out of their way to
> initialize them with per instance state and there is really no good reason
> why somebody would do that.
>
> Agreed.
>
> I think it is time to recognize that the built-in ES constructors have always
> presented a class-like structure where it really is unnecessary and even
> arguably undesirable for their associated prototype objects to also act as
> instance objects. It's time to abandon that precedent and starting with the
> new ES6 built-ins to specify prototypes simply as objects that are containers
> of the methods shared by instances. In general, they should not be usable as
> instance objects.
>
> Current Map constructor allows `class DerivedMap extends Map { }` and it is
> very nice for ECMAScripters.
> So I have an another question. Do you have a plan to change prototype of
> ArrayBuffer and other objects to new style prototype, constructor of them to
> new style like a Map constructor, and Class check(such as [[Class]] is
> "DataView") to internal property check(such as
> object.[[HasProperty]]("DataView")) ?
> Probably because at least ArrayBuffer has no internal specialized method, I
> think transforming to subclassable constructor is easy.
My intention, subject to feedback here and from TC39, is to follow the pattern
I used for Map as much as possible. However, TypedArray object are all ready
implemented by all major browsers to that may limit how we apply it to them.
Allen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss