Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is "Object"?)
Allen Wirfs-Brock
allen at wirfs-brock.com
Sat Sep 29 22:00:19 PDT 2012
On Sep 29, 2012, at 7:26 PM, Rick Waldron wrote:
>
>
> On Sat, Sep 29, 2012 at 6:19 PM, Brendan Eich <brendan at mozilla.org> wrote:
> Allen Wirfs-Brock wrote:
> 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.
>
> Implementations differ:
>
> javascript:alert(Object.prototype.toString.call(Uint8Array.prototype).slice(8,-1))
>
> in Opera says "Uint8Array", while in Firefox and Safari it says "Uint8ArrayPrototype". Chrome says "Object". I can't test IE here.
>
> How common is that? Generally the [[Class]] (NativeBrand?) is derived via
>
> Object.prototype.toString.call(Uint8Array).slice(8,-1)
Note that the intent of [[NativeBrand]] is not just a renaming of [[Class]]. As the change notes for the latest draft stated, that draft as spec. for Object.prototype.toString that support an extensibility model that does not depend upon [[Class]]/[[NativeBrand]]. My hope is that we do not define any new [[Class]]/[[NativeBrand]] values other than the ones that are need to support its legacy use for nominal type testing of the 10 (or so) existing built-ins. I also hope to use the new toString extension point in all the new built-ins. You can see this in the Map specification.
Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120929/d9c15067/attachment.html>
More information about the es-discuss
mailing list