Skip to content

NTuple requires the first type parameter to be Int64 #34977

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

Closed
musm opened this issue Mar 3, 2020 · 2 comments
Closed

NTuple requires the first type parameter to be Int64 #34977

musm opened this issue Mar 3, 2020 · 2 comments

Comments

@musm
Copy link
Contributor

musm commented Mar 3, 2020

Is there any reason why it's restricted to Int64 ?

I.e.

julia> NTuple{Int32(3),Float32}
ERROR: TypeError: in Vararg, in count, expected Int64, got Int32
@timholy
Copy link
Member

timholy commented Mar 3, 2020

Types don't have "sizes," only values have sizes (when you do sizeof(NTuple{N,Float32}) it reports the size of the corresponding value). So there's no advantage in supporting it, and to the contrary supporting only Int avoids nasty "how come these look exactly the same but aren't the same type?!?" train wrecks.

What are you trying to do? Let me guess: this comes up in supporting data types saved via HDF5/JLD/JLD2 on machines with different word sizes? It would be best to normalize the reconstructed types so that N is always Int.

@musm
Copy link
Contributor Author

musm commented Mar 3, 2020

Thanks for the reply. Makes sense and yes that was how this came up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants