<p dir="auto">I found that sometimes function overwriting does not work right away. The method redefinition warning gets triggered, but the old function definition is used.<br>
Here is a minimal test case which shows the bug (the last call fails, but calling <code class="notranslate">f()</code> again then produces <code class="notranslate">2</code> as expected):</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="f() = 1

# at least two calls are required to trigger the bug
f()
f()

f() = 2

@assert f() == 2 # fails"><pre class="notranslate"><span class="pl-en">f</span>() <span class="pl-k">=</span> <span class="pl-c1">1</span>

<span class="pl-c"><span class="pl-c">#</span> at least two calls are required to trigger the bug</span>
<span class="pl-c1">f</span>()
<span class="pl-c1">f</span>()

<span class="pl-en">f</span>() <span class="pl-k">=</span> <span class="pl-c1">2</span>

<span class="pl-c1">@assert</span> <span class="pl-c1">f</span>() <span class="pl-k">==</span> <span class="pl-c1">2</span> <span class="pl-c"><span class="pl-c">#</span> fails</span></pre></div>
<p dir="auto">This is on version <code class="notranslate">0.5.0-dev+4882</code>.</p>
<p dir="auto">if I define a function d2 before a function d1 which calls d2 then change d2, d1 uses the old definition for d2.<br>
I assume this is because it is all precompiled, but maybe there should be a note warning of this? Or would it be possible to replace the old definition with a longjmp to the new one?<br>
(Mostly important for the REPL, since I don't always do a full load)</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; function d2()
       a
       end

julia&gt; function d()
         d2()
       end

julia&gt; d()
in d: a not defined

julia&gt; function d2()
       b=2
       end

julia&gt; d()
in d: a not defined

julia&gt; d2
Methods for generic function d2
d2() at prompt:2

julia&gt; function d()
         d2()
       end

julia&gt; d()
2"><pre class="notranslate">julia<span class="pl-k">&gt;</span> <span class="pl-k">function</span> <span class="pl-en">d2</span>()
       a
       <span class="pl-k">end</span>

julia<span class="pl-k">&gt;</span> <span class="pl-k">function</span> <span class="pl-en">d</span>()
         <span class="pl-c1">d2</span>()
       <span class="pl-k">end</span>

julia<span class="pl-k">&gt;</span> <span class="pl-c1">d</span>()
in d<span class="pl-k">:</span> a not defined

julia<span class="pl-k">&gt;</span> <span class="pl-k">function</span> <span class="pl-en">d2</span>()
       b<span class="pl-k">=</span><span class="pl-c1">2</span>
       <span class="pl-k">end</span>

julia<span class="pl-k">&gt;</span> <span class="pl-c1">d</span>()
in d<span class="pl-k">:</span> a not defined

julia<span class="pl-k">&gt;</span> d2
Methods <span class="pl-k">for</span> generic <span class="pl-k">function</span> d2
<span class="pl-c1">d2</span>() at prompt<span class="pl-k">:</span><span class="pl-c1">2</span>

julia<span class="pl-k">&gt;</span> <span class="pl-k">function</span> <span class="pl-en">d</span>()
         <span class="pl-c1">d2</span>()
       <span class="pl-k">end</span>

julia<span class="pl-k">&gt;</span> <span class="pl-c1">d</span>()
<span class="pl-c1">2</span></pre></div>