Very simple example:
I have a function f with one method, I would like to redefine that method, but call the old implementation from inside the new one. invoke
cannot do this for identical signatures. The following leads to the most recent version of f()
being called recursively:
function f()
println("Old version")
end
# Redefining the same method, but with extra behaviour
function f()
invoke(f)
println("New version")
end
My desired output would be for each print statement to run once.
I found a suggestion somewhere to use world-age, which almost seems to have the desired effect, but using invoke_in_world
prevents the old method from using up-to-date versions of other functions, which is not what I want.