According to http://docs.julialang.org/en/release-0.4/manual/performance-tips/#avoid-fields-with-abstract-containers, this is the way to go for types with a container field:
type MyVector{T<:AbstractFloat,V<:AbstractVector} v::V MyVector(v::AbstractVector{T}) = new(v) end MyVector(v::AbstractVector) = MyVector{eltype(v),typeof(v)}(v) This is indeed type-stable: @code_warntype MyVector(0:0.1:1) However, If I also want to parametrize my type in the vector length L like type MySecondVector{L,T<:AbstractFloat,V<:AbstractVector} v::V MySecondVector(v::AbstractVector{T}) = new(v) end MySecondVector(v::AbstractVector) = MySecondVector{length(v),eltype(v),typeof(v)}(v) This is no longer type-stable: @code_warntype MySecondVector(0:0.1:1) Can I enforce the length as a parameter so that this is known to the compiler or should I look into FixedSizeArrays instead?