# Interactive development

**URL:** <https://discourse.julialang.org/t/interactive-development/313>\
**Category:** General Usage\
**Tags:** question\
**Created:** [November 15, 2016, 2:56am UTC](https://discourse.julialang.org/t/interactive-development/313 "2016-11-15T02:56:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jkroso](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jkroso/32/220909_2.png) [@jkroso](https://discourse.julialang.org/u/jkroso)\
**Post date:** [November 15, 2016, 2:56am UTC](https://discourse.julialang.org/t/interactive-development/313/1 "2016-11-15T02:56:56Z")

</div>

When redefining a subfunction I always have to go back and redefine the top level function since otherwise it continues to use the old definition of the subfunction. Is there a way around this? I have played with `@noinline` and starting julia with `--optimise=0` but it doesn’t seem to help. The REPL session below illustrates what I am talking about.

```julia
julia> a()=b()
a (generic function with 1 method)

julia> b()=1
b (generic function with 1 method)

julia> a()
1

julia> b()=2
WARNING: Method definition b() in module Main at REPL[2]:1 overwritten at REPL[4]:1.
b (generic function with 1 method)

julia> a()
1

```

---

<div class="post-metadata">

**Author:** ![vchuravy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vchuravy/32/8_2.png) [@vchuravy](https://discourse.julialang.org/u/vchuravy)\
**Post date:** [November 15, 2016, 3:03am UTC](https://discourse.julialang.org/t/interactive-development/313/2 "2016-11-15T03:03:07Z")

</div>

What you are seeing is [#265](https://github.com/JuliaLang/julia/issues/265) in action. From what I now this is slated to be fixed in Julia v0.6, but until then there is no good workaround.

---

<div class="post-metadata">

**Author:** ![jkroso](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jkroso/32/220909_2.png) [@jkroso](https://discourse.julialang.org/u/jkroso)\
**Post date:** [November 15, 2016, 5:30am UTC](https://discourse.julialang.org/t/interactive-development/313/3 "2016-11-15T05:30:53Z")

</div>

Ah thanks. Do you know if the idea of an interpreted mode (rather than JIT) has ever been explored?

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihnorton/32/26_2.png) [@ihnorton](https://discourse.julialang.org/u/ihnorton)\
**Post date:** [November 15, 2016, 2:38pm UTC](https://discourse.julialang.org/t/interactive-development/313/4 "2016-11-15T14:38:46Z")

</div>

> [@jkroso](#):
>
> Do you know if the idea of an interpreted mode (rather than JIT) has ever been explored?

There is an interpreter already, but it is relatively slow, and doesn’t yet support all intrinsics (see [https://github.com/JuliaLang/julia/pull/18754](https://github.com/JuliaLang/julia/pull/18754)).

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [November 15, 2016, 10:05pm UTC](https://discourse.julialang.org/t/interactive-development/313/5 "2016-11-15T22:05:49Z")

</div>

Note that interpreting code is not related to fixing #265 at all.

---

<div class="post-metadata">

**Author:** ![akis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/akis/32/156_2.png) [@akis](https://discourse.julialang.org/u/akis)\
**Post date:** [November 18, 2016, 8:03am UTC](https://discourse.julialang.org/t/interactive-development/313/6 "2016-11-18T08:03:11Z")

</div>

Relevant FAQ entry [here](https://discourse.julialang.org/t/overwriting-functions/404) (mostly second half).

---

<div class="post-metadata">

**Author:** ![cstjean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstjean/32/1444_2.png) [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Post date:** [November 18, 2016, 3:44pm UTC](https://discourse.julialang.org/t/interactive-development/313/7 "2016-11-18T15:44:01Z")

</div>

In IJulia, I use this macro:

```julia
macro autorun(expr)
    esc(:(begin
        $IJulia.push_preexecute_hook(()->@eval($expr))
        $expr
        nothing
        end))
end

@autorun a()=b()
@autorun b()=1

a() # 1

@autorun b()=2

a() # 2

```

It’s a hack, but it works.
