"not a Date object" vs. "not an object with [[Class]] of ''Date''"

Alex Russell alex at dojotoolkit.org
Sat Oct 2 10:45:17 PDT 2010


On Oct 2, 2010, at 6:49 AM, Jorge wrote:

> On 02/10/2010, at 15:29, Brendan Eich wrote:
>> On Sep 6, 2010, at 1:43 AM, Dmitry A. Soshnikov wrote:
>> 
>>> For what to create a proxy? It's only for catch-traps (yes, it may be used additionally to create a _catcher_ with "Array" [[Class]], but without additions -- i.e. if a user wants just to inherit from Array.prototype and to have all arrays' stuff -- proxies are not needed to him).
>> 
>> Proxies are required to update length to be one greater than index (property name-string P such that ToString(ToUint32(P)) == P and ToUint32(P) is not 2^32 - 1) when setting an indexed property. Array's magic [[Put]] is not inherited.
> 
> Why not simply spec an Array.create() ?

Or why not simply expose the [[Get]] and [[Set]] protocol for Array so that it can be implemented directly by sub-classers? Having it hidden away in some  primitive property of Array is what makes prototypal extension for Arrays insufficient in the first place, right?

Regards

> -no need to redefine what an array is.
> -no need to learn new concepts ( we're used to Object.create() already )
> -easy to grasp, expected behaviour. 
> -it's a 3-liner that would take no more than 3 minutes to implement in JS in any current UA.
> -it would just need to be in the ES specs.
> -- 
> Jorge.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

--
Alex Russell
slightlyoff at google.com
slightlyoff at chromium.org
alex at dojotoolkit.org BE03 E88D EABB 2116 CC49 8259 CF78 E242 59C3 9723



More information about the es-discuss mailing list