[de-feature request] tuples for const-defined dimensions

Open
#622 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
api

Research direction

Start with the updated discussion at the linked comment and inspect the existing Ix1, Ix2, and Pattern shape APIs in ndarray. Clarify the intended handling of zero- and one-sized dimensions, then establish whether compile-time dimensions should consistently use tuples and verify the resulting API behavior with the project’s tests.

Written by the indexing model from the issue text.

Description

postponed

updated to https://github.com/rust-ndarray/ndarray/issues/622#issuecomment-486792077
(so tuples replacement for arrays, and also still using arrays for 0-sized and 1-sized dimensions)


Hello, I'm new to this ecosystem here- and thanks a lot for your work on it!
As I was using the ndarray crate - it may be just me but - I thought that "what if we always use a tuple to indicate a shape's dimension?".

I mean, this is already how it works most of the time, except for the Ix1 and the dynamic case.
That is, the only case, for compile-time defined number of dimensions, that doesn't fall into what I said above was the Ix1 case, where a single usize is used as a Pattern to indicate a 1-dimensional array.

I propose a de-featuring (feature removal) so that Ix1 case would also require a 1-sized tuple, similarly to the Ix2 (Ix3, etc) cases.

This would simply increase verbosity whenever a Ix1 were to be used, so.. well.. maybe this [proposal] would be taking a step into the wrong direction.
(I'll be PRing for a reference since this would require simple changes after all).

Dominant language
Rust
Stars
4.3k
Forks
391
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rust-ndarray/ndarray

All issues in rust-ndarray/ndarray

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.