New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dimension of an Array is type-specific? #28698
Comments
The type system compares parameters using |
In this scenario it seems annoying, but I can appreciate keeping consistency within the type system as a whole is important. But, why is |
It's because the method table is defined with an expectation that the dimension is an Note that you get the same stack overflow if you pass it an |
Sounds reasonable. Having some more informative error messages about this seems like a good solution. |
At some point we'll add type-parameter typeof constraints, at which point this will be handled. I don't have the exact issue number for that, but it does exist already elsewhere. |
I came upon this having difficulty implementing an
unsafe_wrap
from a multidimensional array returned from a C function (using Julia v0.7)It appears that
Array
cares about thetype
of the dimension that it was defined with. As in:In my function that processed the C array, I used a variable for my dimension, which happened to be an
Int32
, and it was causingunsafe_wrap
to crash. When I cast the dimension asInt64
, everything works fine. For example:I can't see a reason the dimension of an
Array
needs to be type-specific. Is there a good reason for that? Could we upgrade them all toInt64
?I'm also not sure why the dimension being defined as an
Int32
causedunsafe_unwrap
to crash.Thanks.
The text was updated successfully, but these errors were encountered: