I know from reading the Julia documentation (and experimenting), that although String <: AbstractString is true, Array{String} <: Array{AbstractString} is false. So if I have a function that needs to accept an array of all types of strings, what is the right way?
Option 1:
function myFunction(instr::Array{AbstractString,1})
:
end
function myFunction(instr::Array{String,1})
:
end
Option 2:
function myFunction(instr::Union{Array{AbstractString,1}, Array{String,1}})
:
end
Is there a preferred way to do this? Are there performance penalties in using either of these options?
(oh and it should really be AbstractArray because function arguments should dispatch on abstract types, but I didn’t change that to not cause additional confusion).