Skip to content

Express reshape to a certain dimensionality as conversion instead? #23821

@mbauman

Description

@mbauman

We've slowly been converging on the final semantics of our post-#4774 arrays. We've nailed down equality (dimensions are significant in terms of equality), and our indexing behaviors post-#14770 have a nice set of rules about how trailing singletons behave with respect to trailing dimensions:

  • You're allowed to specify fewer indices than there are dimensions so long as all omitted dimensions are 1.
  • You're allowed to specify more indices than there are dimensions so long as all extra indices are 1.

I think this could dovetail quite nicely with conversion — would could allow convert(AbstractArray{<:Any, N}, A) to simply add or remove trailing singleton dimensions. In fact, I think that's a slightly better spelling of this behavior than reshape(A, Val(N)).

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrays[a, r, r, a, y, s]speculativeWhether the change will be implemented is speculative

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions