Why specify argument types and return types

None — myStruct{Float64} is exactly equivalent in performance and memory layout to the second type.

(Think of myStruct{T} not as a single type but as a set of types, which allows you to write type-generic code but still get the performance benefits of concrete struct layouts for particular instances.)

4 Likes