Suppose I have a type, let’s say
struct MyPoint{T<:AbstractFloat}
x::T
y::T
end
My understanding is that this is the best way to declare parametric types as per the Julia performance tips. But suppose you have another type that depends on MyPoint.
struct MyVector{T<:AbstractFloat}
p1::MyPoint{T}
p2::MyPoint{T}
some_parameter::T
end
Is this how that should be done? Or some other way? Should I define abstract type AbstractPoint end , then make MyPoint a subtype of AbstractPoint and then have
struct MyVector{P<:AbstractPoint, T<:AbstractFloat}
p1::P
p2::P
some_parameter::T
end
Is there any reason to do that if MyPoint would be the only subtype of AbstractPoint?