Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

How to add constraints to parametric arguments

$
0
0

Hello,

Still trying to wrap my head around the type system of Julia.

Any explanation why this is not allowed, and what would be the best way to achieve something similar?

struct State{T::Int}
end

Is the only way to achieve that through conditions in the inner constructor? If yes, why is that because it would let users “materialize” type that are not constructible. It might be better to raise the error earlier.

Thank you for your help!

12 posts - 6 participants

Read full topic


Viewing all articles
Browse latest Browse all 2795

Trending Articles