Why not encode dimensions of array in the type system? #1604
Unanswered
SuperNove02
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am fairly new to ndarray. While using the library I was a little bit confused on why every operation between arrays panics. Why is not the size of a 2darray encoded in the type system via a const parameter?
To be honest i would have guessed that an 2 dimensional array would look a little bit like this (of course this is very simplified):
With this design the type checker can know at compile time that i.e. matrix multiplication fails due to incomplete dimensions. However ndarray does not give this guarantee:
I do not want to criticize the project in any way i am just interested in the design decision and maybe there is a way of having this safety in ndarray, which i do not know.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions