typed-objects-es7 icon indicating copy to clipboard operation
typed-objects-es7 copied to clipboard

Add redimension method for arrays

Open nikomatsakis opened this issue 11 years ago • 0 comments

Arrays need a redimension method that lets you redistribute their elements over any number of dimensions. As implemented in SpiderMonkey, this method lets you:

  1. Convert a non-array type T into an array type T([1])+ -- i.e., any number of dimensions, as long as they all have length 1.
  2. Convert an array type T[...] into an array type U[...] as long as T and U are equivalent.

Note that this second test is slightly wrong: we should require that T === U to preserve aliasing guarantees (we could do T === U || (T.isTransparent() && U.isTransparent() && T.equivalent(U)), but why? you could always cast the buffer).

nikomatsakis avatar Mar 27 '14 13:03 nikomatsakis