Julia doesn't dispatch on abstract types; if there is more than one applicable 
version of a function available, but it can't determine the type(s) at 
compile-time, then it waits until execution for all types to be concrete 
before determining which variant of a function to call.

So likewise, you should use `which` only with concrete types.

--Tim

On Friday, June 06, 2014 03:04:13 PM Jutho wrote:
> I suddenly had the idea of using which in the following way
> which(g,(typeof(x),))!=which(g,(AbstractSupertype,))
> 
> to determine that g had a more specific implementation then the fallback
> method defined for AbstractSupertype.
> 
> Quickly testing how to use with I typed the following in the REPL and got a
> confusing result.
> 
> *julia> **which(issym,(Matrix,))*
> 
> *issym(A::AbstractArray{T,2}) at linalg/generic.jl:251*
> 
> 
> *julia> **which(issym,(AbstractMatrix,))*
> 
> *issym(A::SparseMatrixCSC{Tv,Ti<:Integer}) at sparse/sparsematrix.jl:1739*
> 
> 
> I would have thought that which(issym,(AbstractMatrix,)) would also point
> to the first method. Is this a bug? Should I file an issue?

Reply via email to