julia> struct MyFunction <: Function x end julia> (f::MyFunction)(arg) = f.x*arg julia> Base.show(io::IO, f::MyFunction) = println(io, "MyFunction with x=$(f.x)") julia> f = MyFunction(3) (::MyFunction) (generic function with 1 method) julia> f (::MyFunction) (generic function with 1 method) julia> show(f) f = MyFunction with x=3
The second and third to last lines invoke the
show method for
Functions, instead of my more specific
MyFunction method. Is this a bug or a feature, and what can I do to overrule it?