Thanks for your answers. I used strategy with something like "do_it" script 
when working in Octave, but I found that it doesn't provide full REPL 
experience. In REPL I can experiment with different approaches, save state 
of long-running computations, see results and decide where to go further 
without replaying all operations. With "do_it" script all these things are 
just harder and tale longer (though I still replay everything from time to 
time to clear possibly dirty state). 

Autoreload.lj looks good, but it seems like problem lies deeper in Julia 
itself. Today I found that if I write "using MyMod" and then change any 
definition (say, function "myfun()") from it, there's no way to update this 
definition in Main. Consider following case study. I have following in file 
"MyMod.jl":

-------------------------
module MyMod
export myfun

function myfun()
    println("version 1")
end

end
------------------------

Then in REPL I do: 

 julia> using MyMod

 julia> myfun()
 version 1


Looks ok. Now let's change printed expression to "version 2" and send new 
module to REPL: 

julia> 
include("/home/slipslop/work/MiLK/MyMod.jl")                                    
                                                                                

 Warning: replacing module MyMod

Ok, this is what I expected. MyMod is completely replaced with a new one. 
And what about "myfun"?

 julia> myfun()
 version 1

Nope, it's not reloaded by itself (though qualified name "MyMod.myfun()" 
works fine). Let's re-import names from MyMod: 

 julia> using MyMod
 Warning: using MyMod.myfun in module Main conflicts with an existing 
identifier.

 julia> myfun()
 version 1

So Julia sees conflicting name and does NOT replace definition. "reload()", 
"areload()", "arequire()", etc. just reload module, but they don't help to 
update existing names in the Main. The only way to see updated version is 
to use qualified name: 

 julia> MyMod.myfun()
 version 2

Is there any way to update definitions that where imported into Main with 
"using" statement? 

Reply via email to