I am confused about how to organize my code for objects which behave like functions. Some functions do different things when called with arguments which are
<: Function, eg
Plots.plot will plot the function, but will not plot a callable object which is not
<: Function (because it can’t dispatch on it, unless a recipe is defined etc).
Generally, a type
- can have
(f::T)(...)methods defined, and
T <: Functioncan hold.
Apparently these two are orthogonal, one can have a
<: Function without it being callable, and vice versa. I am wondering if it is good style to impose both at the same time, or if there are good arguments for doing one but not the other.
Sorry if the question is vague. I am assuming that others have ran into this and would like to hear what you think.