Brendan:

To clear up something that misled me when reading the first few messages of 
this struct thread:

I assume that the proposal is that:

const TA =
   Array.newTypedArray(fixed_length,
                       Object.newStructType({x:"u32", y:"u32", z:"u32",
                                             r:"u8", g:"u8", b:"u8", a:"u8"}));
let a = new TA(...);

b = a[i];
a[i].x += 1;

Now b.x also reflects the new value of a[i].x; i.e. b is an alias, not a 
mutable copy.  The same thing would happen if one had mutated b.x.

That leads to a couple plausible meanings of b === a[i]:

1.  Pointer equality:  True if and only if mutating one's contents would mutate 
the other's.

2.  Recursive value equality:  True if and only if all of their constituent 
elements are ===.  I hope that you can't have things like aliases themselves as 
first-class values inside structs, as that could create cycles (although you 
could still make === work in that case if you really wanted to).

Bit-by-bit equality is not desirable in the presence of NaN's and signed 
zeroes.  If we go with choice 2, the struct {x:17, y:NaN} should not be === to 
{x:17, y:NaN}.  Using bit equality, it might or might not be ===, which then 
could be used to discriminate among different kinds of NaN's.  There is 
currently nothing in the language with that power and I'd prefer to keep it 
that way.

   Waldemar
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to