Non-extensibility of Typed Arrays

Andreas Rossberg rossberg at
Thu Sep 5 00:15:11 PDT 2013

On 5 September 2013 03:11, Niko Matsakis <niko at> wrote:
> On Wed, Sep 04, 2013 at 02:41:24PM -0700, Brendan Eich wrote:
>> 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 just want to agree with this. I think the behavior of `==` is
> unfortunate, but much more of a corner case than expando properties
> disappearing and reappearing willy nilly as users switch between
> otherwise identical views on the same data.
> I feel like `==` can be explained by the fact that these are distinct
> objects pointing at the same underyling buffer. People get aliasing.
> But the fact that expando properties would live *on the wrapper* and
> not on the *underlying data* is quite surprising and counterintuitive
> -- some of the data (the elements) are aliased, but others are not.

Maybe it actually _is_ worth considering a different equality
semantics for structs and typed arrays. In essence, they are a kind of
super-fat pointer, and we could give them the usual notion of (fat)
pointer equality. That is, two objects are equal if they are
equivalent views to the same backing store. It would make them value
types, more or less.

As an implementor, I don't like this idea too much :), but from a user
perspective it would probably be saner.


More information about the es-discuss mailing list