On Tuesday, April 29, 2014 4:38:59 PM UTC+1, John Myles White wrote:
>
> On Apr 29, 2014, at 8:28 AM, Oliver Woodford 
> <oliver....@gmail.com<javascript:>> 
> wrote:
>
>  
> Are you saying that f{T<:Real}(a::Array{T}) covers both homogeneous and 
> heterogeneous arrays, whereas f(a::Array{Real}) only covers heterogeneous 
> arrays? If that's the case it strikes me as just as confusing.
>
>>
> This is indeed how parametric types work in Julia.
>
> Array{T} is a family of types, one for each value of T. Defining 
> f{T}(a::Array{T}) allows you to generically define an infinite number of 
> functions -- you get a unique function for each value of T. 
>

Yes, understood.
 

>
> In contrast, Array{Real} is a single type -- specifically, the type 
> generated by the parametric type Array{T} when its parameter T = Real. 
> There is no variable T, so f(a::Array{Real}) defines exactly one function 
> -- and that function accepts exactly one type of input.
>

Yes, understood.
 

>
> Array{Any} is also a single type.
>
>  -- John
>
>
However, you haven't addressed the point I make in my post. I will post it 
again, stated more clearly.


 

Reply via email to