-
-
Save jrevels/1a41f9f1682acf324fc0e4b002bc6a77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
julia> f(x) = println("hello") | |
f (generic function with 1 method) | |
julia> callf(x) = f(x) | |
callf (generic function with 1 method) | |
julia> const callf_lowered = @code_lowered callf(1) | |
CodeInfo(:(begin | |
nothing | |
Core.SSAValue(0) = (Main.f)(x) | |
return Core.SSAValue(0) | |
end)) | |
julia> @generated function g(x) | |
return deepcopy(callf_lowered) | |
end | |
g (generic function with 1 method) | |
julia> g(1) | |
hello | |
julia> f(x::Int) = println("goodbye") | |
f (generic function with 2 methods) | |
julia> g(1) | |
goodbye | |
julia> f(1) | |
goodbye | |
julia> f(1.0) | |
hello | |
julia> g(1.0) | |
hello |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment