I’m not sure what you trying to accomplish, but the following code works:
julia> struct F{T} <: Function
f::T
end
julia> (self::F)(x) = self.f(x)
julia> test_func1 = F(i::Int -> i + 1)
(::F{var"#3#4"}) (generic function with 1 method)
julia> test_func2 = F(i::Int -> i - 1)
(::F{var"#5#6"}) (generic function with 1 method)
julia> test_func1(1)
2
julia> test_func2(1)
0
julia> (self::F)(x) = println("ddd")
julia> test_func1([1, 2, 3])
ddd
julia> test_func2([1, 2, 3])
ddd
julia>