How do you invoke a method (like a specific method, not a function)?```julia>

How do you invoke a method (like a specific method, not a function)?

julia> func(a) =5
func (generic function with 1 method)

julia> meth = first(methods(func))
func(a) in Main at REPL[83]:1

julia> meth(1)
ERROR: MethodError: objects of type Method are not callable
Stacktrace:
 [1] top-level scope
   @ REPL[85]:1
 [2] eval
   @ .\boot.jl:360 [inlined]

Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropriate answer back to Slack, or pinging the poster here on Discourse so they can follow this thread.
(Original message :slack:) (More Info)

Avik Sengupta 20 minutes ago

invoke(func, Tuple{Int}, 5)

Sebastian Pfitzner 15 minutes ago

aka invoke(first(meth.sig.parameters).instance, Tuple{meth.sig.parameters[2:end]...}, 5) (edited)

Heetbeet 2 minutes ago

Ah okay, or in that case also

(first(meth.sig.parameters).instance)(5)

Heetbeet 2 minutes ago

Thanks

Sebastian Pfitzner 1 minute ago

Right. Don’t rely on that working though, it’s not a public API

Heetbeet < 1 minute ago

Okay, will keep it as a toy only