On Oct 1, 2010, at 7:00 PM, Oliver Hunt wrote:
> What part of the use case is not covered? From reading the blog post (which
> suggests something similar to this) kangax says the problem with this
> solution is the use of the non-standard __proto__, not that it doesn't
> achieve the desired result
The crucial issue is whether a non-Arrray instance is essential:
MyArray instance --[proto]--> MyArray.prootype --[proto]--> Array.prototype
--[proto]--> Object.prototype
Cc'ing kangax.
/be
>
> --Oliver
>
>>
>> /be
>>
>>>
>>> In a engine that support mutating proxies this would be equivalent to:
>>>
>>> function MyArray() {
>>> var result = Array.apply(null, arguments);
>>> result.__proto__ = MyArray.prototype;
>>> return result;
>>> }
>>>
>>> MyArray.prototype = Object.create(Array.prototype);
>>>
>>> If my understanding of this desired behaviour is correct, i think a better
>>> solution would be to make an API that could generate the MyArray function.
>>>
>>> --Oliver
>>>
>>>
>>> On Oct 1, 2010, at 6:14 PM, Brendan Eich wrote:
>>>
>>>> KangaX brought this up in
>>>>
>>>> http://perfectionkills.com/how-ecmascript-5-still-does-not-allow-to-subclass-an-array/
>>>>
>>>> and proxies are of no avail. To make an array-like using ES5 is possible
>>>> but [[Class]] won't lie, and that is still true with Proxy.create instead
>>>> of Object.create.
>>>>
>>>> As we have discussed, [[Class]] is very much a nominal type tag, so it is
>>>> not something we want to be forged by an impostor. But perhaps as Allen
>>>> mentioned in the TC39 meeting this week, [[ClassName]] could be separated
>>>> from [[Class]], and forged without problem. Proxies would want to be able
>>>> to present a specific [[ClassName]], but a non-varying one -- so probably
>>>> a trailing Proxy.create parameter. Thoughts?
>>>>
>>>> /be
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss