How to I force re-definition of a function in memory?

Hello,
I have a JuMP script of this type:

using JuMP
function myModel(α)
 ...model definition, solving and printing results..
end
mymodel(α)

When I change myModel() function however Juno doesn’t recognise the change and reload it, even if I select “run script”, that is the old myModel() function object remains in the memory.
I did try to put a workspace() at the beginning of my script, but then JuMP complains in the solve() function.
Following https://github.com/JuliaLang/julia/issues/2385 I did try clear(myModel) but I got the error UndefVarError: clear not defined.

So, how can I force in Juno a function that has been already loaded in memory to be loaded again, without stopping/restarting Julia every times ?

On 0.5, use anonymous functions:

myModel = function(a)
...
end

On 0.6, it should work.

1 Like