@show_code macro

Hey :slight_smile:

Is there a @show_code yet?

e.g.:

julia> @show_code sqrt(1+1)
sqrt(1+1) in Main at REPL[10]:1

In file.jl

1:
2:@show_code sqrt(1+1)
3:

after running returns:
sqrt(1+1) in file.jl:2

So I can do:
In file.jl

1:
2:@time @show_code sqrt(1+1)
3:

after running returns:

 sqrt(1+1) in file.jl:2`
 0.000000 seconds

You can use @code_string from CodeTracking.jl.

3 Likes

Oh that’s also cool, but goes one level to deep for me. I what something more like the written code + line number + File

In file.jl

1:
2:@show_code sqrt(1+1)
3:

after running returns:
sqrt(1+1) in file.jl:2