I generally write function signatures with the where-clause outside of the arguments list. Is there any reason why one would put that inside the function signature? e.g.
foo(x::T where T) = 1
foo(x::T) where T = 2
foo(1) # 2
But then they seem to be equivalent as it reports only 1 method:
It also matters if you want to use the type T in the function body:
julia> f(::T where T) = T
f (generic function with 1 method)
julia> f(1)
ERROR: UndefVarError: T not defined
Stacktrace:
[1] f(::Int64) at ./REPL[1]:1
[2] top-level scope at REPL[2]:1
julia> f(::T) where T = T
f (generic function with 1 method)
julia> f(1)
Int64
Hi, I meant the scope of the fresh type variable.
Technically, where is the same thing as the forall quantifier.
Check this wiki subsection for more about the scope.