>
> It seems to me that when I execute one of the module functions on x the
> original version of the function, not the revised version, gets called.

First, is my understanding of what's going on correct?


Yes, if you are holding an alias to the "old" module, it doesn't get
updated.

Second, any recommendations for dealing with this?  In this case
> regenerating x was not a big deal, but I can imagine situations that
> weren't so trivial.  If there were lots of objects involved, one could keep
> a script that creates them and rerun it.


You can use `workspace()` to clear everything, but that might not be
desirable...

For interactive projects where there is a lot of setup, I often write all
repeated code in a text file inside a module with a short name ("X"), and
then just repeatedly reload that text file and call a single function to
execute the changes. I believe Juno uses some fancier techniques to allow
interactive updating and executing, you might want dig in the code and see
if you can adopt similar techniques for ESS.

```
file X.jl:
  module X
  import Y

  ...
  function run()
    ...
  end
  end # module X

  X.run()

REPL:
julia> include("X.jl")
```



On Thu, May 12, 2016 at 3:39 PM, Boylan, Ross <ross.boy...@ucsf.edu> wrote:

> A file has code surrounded by a module declaration.  It includes
> definitions of some types and some functions.
> In the REPL (ESS) I include the file and execute a function that returns
> me an object x of type MyModule.Foo.
> Then I change some of the code and include the module again.  The type Foo
> is unchanged.
>
> It seems to me that when I execute one of the module functions on x the
> original version of the function, not the revised version, gets called.
>
> If I recreate x then I get the current function definitions aka what I
> wanted.
>
> First, is my understanding of what's going on correct?
>
> Second, any recommendations for dealing with this?  In this case
> regenerating x was not a big deal, but I can imagine situations that
> weren't so trivial.  If there were lots of objects involved, one could keep
> a script that creates them and rerun it.
>
> Thanks
> Ross Boylan

Reply via email to