It chooses the one which is "the mos specific". Array{state} <: Any so 
Array{state} is more specific and thus that function will be called.

On Thursday, September 17, 2015 at 6:11:58 PM UTC+2, [email protected] wrote:
>
> Well, thanks everyone, I think I understand now why it doesn't work when 
> specifying Array{Any}, and your answers completed each other.
> What I still fail to understand is why how Julia manages to choose the 
> correct function, assume I still have:
>
> function f(s)
>   println(s.x)
> end
>
> function f{T}(sl::Array{T})
>   for s in sl
>     f(s)
>   end
> end
>
> If I call f on an Array of state, how does Julia know that it has to 
> choose the second function... After all, the argument of the first function 
> could still be an Array of state...
>

Reply via email to