Skip to content

Add redimension method for arrays #6

@nikomatsakis

Description

@nikomatsakis

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions