To get dispatch working for arrays of any subtype of String, you have to
write your function using a type parameter:
f{T<:String}(a::Array{T,1}) = a[1]
should work for both Array{ASCIIString,1} and Array{String,1}
On Monday, July 7, 2014 12:54:19 PM UTC+1, Mauro wrote:
>
> This is because of invariance:
>
> "
> This last point is very important:
>
> Even though Float64 <: Real we DO NOT have Point{Float64} <: Point{Real}.
>
> In other words, in the parlance of type theory, Julia’s type parameters
> are invariant, rather than being covariant (or even contravariant).
> "
>
>
> http://docs.julialang.org/en/latest/manual/types/#parametric-composite-types
>
>