Semi-deep copy of array

Your code below:

function recursivecopy(a)
  deepcopy(a)
end

recursivecopy(a::Union{SVector,SMatrix,SArray,Number}) = copy(a)

function recursivecopy(a::AbstractArray{T,N}) where {T<:Number,N}
  copy(a)
end

function recursivecopy(a::AbstractArray{T,N}) where {T<:AbstractArray,N}
  map(recursivecopy,a)
end

Here, none of the specific methods appears to be applicable to MyType.

So I would extend it like this:

function recursivecopy(a::AbstractArray{T,N}) where {T::MyType,N}
  map(recursivecopy,a)
end

function recursivecopy(a::MyType)
  myspecialcopy(a)
end

Is that correct?

Meaning if I don’t have nested arrays I don’t actually call any of your code, but your code shows me how to implement the function.

Thank you!