Getting function's module by a MethodInstance

I’ve played with this a bit in the meantime too. (Your question was useful since it made me think about this a bit more.) Here’s how SnoopCompile now deals with this:

https://github.com/timholy/SnoopCompile.jl/blob/484231c34cb43f392f1d1aeeb0baad672c47b27a/src/parcel_snoopi_deep.jl#L1582-L1608

ft2f (“function type to function”) is only used to print stuff to the REPL, so all that was needed was a good fallback for the case of a closure. And yes, just as you say I do have to Base.unwrap_unionall it before calling ft2f.

1 Like