<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="julia&gt; function f()
       const a = 1;
       a = 2;
       return a;
       end
f (generic function with 1 method)

julia&gt; f()
2"><pre class="notranslate"><code class="notranslate">julia&gt; function f()
       const a = 1;
       a = 2;
       return a;
       end
f (generic function with 1 method)

julia&gt; f()
2
</code></pre></div>
<p dir="auto">Although it is not that important for the compiler/optimizer to declare a local constant variable as it can probably figure out itself, it is still useful as a hint/constraint for the user to avoid stupid error or breakage sometimes.</p>
<p dir="auto">IMHO, as long as local const variable is a valid syntax, it should at least give a warning if the value/binding changes (just as the global one). It might even make sense to be more restrictive and make that an error instead of a warning.</p>
<p dir="auto">Not sure what's going on here – this runs but no <code class="notranslate">.mem</code> file appears. The same issue may affect measuring coverage (the logging logic is shared). It might be good to add some testing for this and run those tests under CI on Travis and AppVeyor.</p>