Hacker News new | ask | show | jobs
by lindbergh 2021 days ago
Totally unrelated since I can't access the website, but one thing that I'd like to see in a typing system used in data analysis is to be able to see the dimension of the data structures used. For instance, to be able to tell at compile time if a matrix multiplication is going to crash due to dimension mismatch.

So far, in Python at least, at best I can tell that it's a float array, without specifying the dimension (for example 2d for a matrix) or better, specifying its dimension is (n,p) where n and p are both type variables.

1 comments

I believe that catching that at compile-time in Rust would have to wait for RFC 2000 to be implemented: https://rust-lang.github.io/rfcs/2000-const-generics.html

This would allow generics that depend on const values (i.e. matrix dimensions in this context). At present generics can only depend on types.