Code associated with `invoke`

willtebbutt
Fri, 09 Jun 2023 14:56:34 +0000
General Usage

Is it possible to obtain the code associated with an invoke call?

Specifically, if I were to write:

sin(5.0)

I know that I can get access to one of various representations of the code via code_lowered, code_typed, etc. What is not clear to me is how I can do the analogous thing for

invoke(sin, Float64, 5.0)

Something like

@code_lowered invoke(sin, Float64, 5.0)

will fail because invoke is a built-in, so doesn’t have Julia code associated with it directly.
Is there a separate piece of functionality that I could use to return the code that invoke looks up?

5 posts - 3 participants