On Thursday, September 17, 2015 at 9:45:11 AM UTC-4, [email protected] wrote:
>
> I don't really get why though, what mechanism prevents Julia to use the 
> first version now?
> Does it look at all the available functions called f and see if one is 
> better suited, is likely to produce an error of some sort, something else?
>

This is called parametric invariance.  See here for more details: 
http://docs.julialang.org/en/release-0.4/manual/types/#parametric-composite-types

A type theorist will be able to tell you lots more, but on a practical 
level, it allows `Array{Int}` to be stored *differently* than an 
`Array{Any}`.  The latter is an array of pointers to other memory regions, 
whereas the former is just a contiguous chunk of raw `Int`s.  This is 
crucially important for fast numeric arrays and interop with BLAS and other 
C libraries.

Reply via email to