Thanks to everyone for the replies.

So do I understand the following correctly: if I separate my functions
and runtime code (eg MyModule and MyModuleRun), and then want to
redefine a single function in the first, then I have to reload the whole
module again?

Julia seemed so ideal for exploratory programming at first, but then it
looks like I cannot manipulate the image freely and restarts are
required all the time, which is somewhat time-consuming. Perhaps I am
missing something important in my understanding, still trying to use
Julia similarly to Common Lisp, which is very flexible in this respect.

Best,

Tamas

On Tue, Jan 20 2015, Tim Holy <[email protected]> wrote:

> My workflow (REPL-based, Juno in particular is probably different):
> - Open a file ("MyModule.jl") that will consist of a single module, and 
> contains types & code
> - Open a 2nd file ("mymodule_tests.jl") that will be the tests file for the 
> module. Inside of this file, say `import MyModule` rather than `using 
> MyModule`; you'll have to scope all calls, but that's a small price to pay 
> for 
> the ability to `reload("MyModule")` and re-run your tests.
> - Open a julia REPL
> - Start playing with ideas/code in the REPL. Paste the good ones into the 
> files. And sometimes vice-versa, when it's easier to type straight into the 
> files.
> - When enough code is in place, restart the repl. Cycle through
>     reload("MyModule")
>     include("mymodule_tests.jl")
>     <edit these two files>
> until things actually work.
>
> --Tim
>
> On Tuesday, January 20, 2015 01:09:01 PM Viral Shah wrote:
>> This is pretty much the workflow a lot of people use, with a few julia
>> restarts to deal with the issues a) and b). I often maintain a script as
>> part of my iterative/exploratory work, so that I can easily get to the
>> desired state when I have to restart.
>> 
>> -viral
>> 
>> On Tuesday, January 20, 2015 at 4:15:13 PM UTC+5:30, Tamas Papp wrote:
>> > Hi,
>> > 
>> > I am wondering what the best workflow is for iterative/exploratory
>> > programming (as opposed to, say, library development).  I feel that my
>> > questions below all have solutions, it's just that I am not experienced
>> > enough in Julia to figure them out.
>> > 
>> > The way I have been doing it so far:
>> > 1. open a file in the editor,
>> > 2. start `using` some libraries,
>> > 3. write a few functions, load data, plot, analyze
>> > 4. rewrite functions, repeat 2-4 until satisfied.
>> > 
>> > I usually end up with a bunch of functions, followed by the actual
>> > runtime code.
>> > 
>> > However, I run into the following issues (or, rather, inconveniences)
>> > with nontrivial code:
>> > 
>> > a. If I redefine a function, then I have to recompile dependent
>> > functions, which is tedious and occasionally a source of bugs
>> > (cf. https://github.com/JuliaLang/julia/issues/265 )
>> > 
>> > b. I can't redefine types.
>> > 
>> > I can solve both by restarting (`workspace()`), but then I have to
>> > reload & recompile everything.
>> > 
>> > I am wondering if there is a more organized way of doing this --- eg put
>> > some stuff in a module in a separate file and just keep reloading that,
>> > etc. Any advice, or pointers to tutorials would be appreciated.
>> > 
>> > I am using Emacs/ESS.
>> > 
>> > Also, is there a way to unintern symbols (a la CL) that would solve the
>> > type redefinition issue?
>> > 
>> > Best,
>> > 
>> > Tamas

Reply via email to