Hi, 

Why do i need to specify all the parameters in the signature of methods 
that take `::Type` arguments? 

Demo:
# define some parametric type
julia> immutable foo{T, N, P, S}
       end

# this will not work, but it seems natural to omit trailing unused 
parameters
julia> bar{T}(::Type{foo{T}}) = T
bar (generic function with 1 method)

# yes, it does not work
julia> bar(foo{1, 2, 3, 4})
ERROR: MethodError: `bar` has no method matching bar(::Type{foo{1,2,3,4}})

# this will do the job, 
julia> bar2{T, N, P, S}(::Type{foo{T, N, P, S}}) = T
bar2 (generic function with 1 method)

# yep
julia> bar2(foo{1, 2, 3, 4})
1


In methods that take instances of a type it is usually not necessary to 
specify trailing unused parameter, meaning that, for instance
baz{T}(f::foo{T}) = one(T)
will work for any values of `N`, `P` and `S`.

Thanks!

P.S. This is on 0.4



Reply via email to