That is, without a Union. I still would like the function to be typed. So I don’t see
g(f, a) = let
f(a)
end
as a solution (f should be typed).
That is, without a Union. I still would like the function to be typed. So I don’t see
g(f, a) = let
f(a)
end
as a solution (f should be typed).
Well, you can require that your functor types declare themselves as subtypes of Function (which is an abstract type that can be used as the parent of any type!).
Otherwise I don’t see how to avoid duck-typing. Any type can be made callable in Julia, so there is no way to identify callable objects by type in general.
See also: Is `Base.Callable` OK to use? Should it be documented? · Issue #43491 · JuliaLang/julia · GitHub
Good jumping off point, Stephen. Interesting discussion, that. Thank you.