In preparation to the second tutorial, it probably makes sense to highlight that it is not about (subtype of) abstract field types versus concrete field types for the struct (as you imply with the content at the bottom of the page).
Rather it is about parametric (possibly subtype of abstract) type parameters versus abstract field types:
struct ParametricAbstract{T <: Real}
x::T
y::T
end
struct Abstract
x::Real
y::Real
end
julia> ParametricAbstract(2f0, 2f0) |> Base.summarysize
8
julia> Abstract(2f0, 2f0) |> Base.summarysize
24
I think the rule of thumb should be:
- It’s okay and often even encouraged to be (subtype of) abstract in the header (defining the type parameters of a struct or the arguments of a method),
- but you should be specific in the body (using a concrete type or type parameter).
The reason for this rule of thumb is (no surprise here): multiple dispatch (or after thinking a bit more about it) and specialization.