Non-extensibility of Typed Arrays

David Herman dherman at mozilla.com
Fri Aug 30 16:03:42 PDT 2013


On Aug 30, 2013, at 3:54 PM, Filip Pizlo <fpizlo at apple.com> wrote:

> Yup, that's what I was concerned about.  And reading over the spec I agree.  But just for sanity, we're guaranteeing this because you cannot create a struct type instance by pointing into an arbitrary offset of a buffer - you can only instantiate new ones, or alias structs nested as fields in other structs.  Right?

Hm, I must be missing something obvious, but I don't see why you'd need that restriction to guarantee this. A struct type with two different fields guarantees they're at different offsets from the base:

    var T = new StructType({
        a: int32, // offset 0
        b: int32  // offset 4
    });

so even if I point an instance of T into the middle of a struct, x.a and x.b must be at different offsets.

Dave



More information about the es-discuss mailing list