I am implementing functor types. A simple example is the absolute value functor. (There is a scaling just to make the problem worthwhile.)
abstract type AbFun{F<:Real} end
struct Magnitude{F} <: AbFun{F}
scale::F
end
Magnitude() = Magnitude(1.)
(self::Magnitude{F})(x::F) where F = abs(self.scale*x)
Now I have a function which has a fixed paramter L.
struct Huber{L, F} <: AbFun{F}
scale::F
end
Huber() = Huber{1., typeof(1.)}(1.)
function (self::Huber{L, F})(x::F) where {L, F}
sx = abs(self.scale*x)
sx<1/L ? L*sx*sx/2 : sx-.5/L
end
I think the where notation was introduced precisely to avoid that confusion.
Note that unity is a function, not a type.
They changed this syntax unit{T}(x::T) = one(T) to unit(x::T) where T = one(T) so that when you see something like something{T}(x::T)... you can be sure that that is a constructor to a type something with parametric type T, not a function with type signature.
Ps: When you define Huber{L,F}(x::F) = ... you are defining a type constructor, not a function!