How do you remove a function you have created when working in the Julia REPL? Can this be done without restarting the session?
This is an old question several years ago. I just want to check if there is new updates in Julia 1.7 on this point?
It is quite annoying to debug a function by keeping on restart the Julia REPL.
If it is only about redefining methods it shouldn’t be any problem, new methods with the same type signature as a previously existing one it will just overwrite the previous ones.
Its best to use Revise.jl for this. Put your function in a file then run using Revise; Revise.includet("thatfile.jl"), or put it in a package in which case just using Revise, YourPackage. Then edit the source file and Revise will live-update changes to it into your running session, including deleting a method if you delete it / comment it inside the source.
In a pinch you can technically also do this by hand using Base.delete_method but its not nearly as user friendly.
The overwrite seems only happens after successfully compiled. When I try to write some complex functions, I usually generate many errors, especially for multiple dispatch functions of multi-variables. I usually get lost on the debug after several errors. It seems Julia REPL also get lost. It will quite helpful if I can clear “function()” without restarting.
Good to know Revise.jl .It is very interesting and looks helpful. Although I still fails after tried several times.
Do you know if Julia and/or vscode will add “Revise.jl” into its standard package in future?