Non-extensibility of Typed Arrays

Brendan Eich brendan at mozilla.com
Wed Sep 4 14:41:24 PDT 2013


Filip Pizlo wrote:
> I agree that both of these aspects of binary data are quirky.  My 
> observation is that prohibiting custom properties doesn't fix the 
> underlying issue.
>
> [snip]
>>     var MyArray = new ArrayType(...);
>>     var MyStruct = new ArrayType({f: MyArray});
>>     var struct = new MyStruct(...);
>>     var array1 = struct.f;
>>     var array2 = struct.f;
>>
>> then `array1` and `array2` would have disjoint sets of extensible
>> properties.]
>
> Yes, they would.  But even if they didn't, then array1 != array2, 
> which is equally odd.

Both adds up to two, not one, so the counterargument is odd beats odder, 
and prohibiting expandos keeps the oddness down to == and nothing else.

I'm not trying to persuade you here, just trying to agree on how to do 
"oddness accounting". It could be that we're better off with the oddness 
you prefer, for human factors reasons of some kind.

But "lost expandos" due to loss of identity are an especially nasty kind 
of bug to find. Is there any use-case here? We've never had a bug report 
asking us to make SpiderMonkey's typed arrays extensible, AFAIK.

/be


More information about the es-discuss mailing list