Look up covariance, contravariance and invariance on Wikipedia.

 -- John

> On Nov 29, 2014, at 12:38 PM, Petr Krysl <[email protected]> wrote:
> 
> Newbie-type question:
> 
> This is true:
> Float64 <: FloatingPoint
> 
> This is false:
> Array{Float64} <: Array{FloatingPoint}
> 
> Why?  I'm perhaps not referring here to the actual code to explain why.  
> Rather why should this be so?
> 
> Let us say I wanted to write a function
> 
> function f(a::Array{FloatingPoint})
>   show(a)
> end
> 
> And then
> 
> #define an array
> A=Float64[1.0 2.0; -3.0 -4.0; 5.0 6.0]
> #this will fail.  Why should it fail?
> f(A) 
> 
> Petr
> 

Reply via email to