<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="x = [
    1 2 3 4 5 6;
    2 3 4 5 6 7;
]
const y = x

let
    local a = x
    @time for i in 1:10^4 reshape(a, 12) end
end
0.002322 seconds (20.00 k allocations: 781.250 KB)

let
    local a = y
    @time for i in 1:10^4 reshape(a, 12) end
end
0.000344 seconds (10.00 k allocations: 625.000 KB)"><pre class="notranslate">x <span class="pl-k">=</span> [
    <span class="pl-c1">1</span> <span class="pl-c1">2</span> <span class="pl-c1">3</span> <span class="pl-c1">4</span> <span class="pl-c1">5</span> <span class="pl-c1">6</span>;
    <span class="pl-c1">2</span> <span class="pl-c1">3</span> <span class="pl-c1">4</span> <span class="pl-c1">5</span> <span class="pl-c1">6</span> <span class="pl-c1">7</span>;
]
<span class="pl-k">const</span> y <span class="pl-k">=</span> x

<span class="pl-k">let</span>
    <span class="pl-k">local</span> a <span class="pl-k">=</span> x
    <span class="pl-c1">@time</span> <span class="pl-k">for</span> i <span class="pl-k">in</span> <span class="pl-c1">1</span><span class="pl-k">:</span><span class="pl-c1">10</span><span class="pl-k">^</span><span class="pl-c1">4</span> <span class="pl-c1">reshape</span>(a, <span class="pl-c1">12</span>) <span class="pl-k">end</span>
<span class="pl-k">end</span>
<span class="pl-c1">0.002322</span> seconds (<span class="pl-c1">20.00</span> k allocations<span class="pl-k">:</span> <span class="pl-c1">781.250</span> KB)

<span class="pl-k">let</span>
    <span class="pl-k">local</span> a <span class="pl-k">=</span> y
    <span class="pl-c1">@time</span> <span class="pl-k">for</span> i <span class="pl-k">in</span> <span class="pl-c1">1</span><span class="pl-k">:</span><span class="pl-c1">10</span><span class="pl-k">^</span><span class="pl-c1">4</span> <span class="pl-c1">reshape</span>(a, <span class="pl-c1">12</span>) <span class="pl-k">end</span>
<span class="pl-k">end</span>
<span class="pl-c1">0.000344</span> seconds (<span class="pl-c1">10.00</span> k allocations<span class="pl-k">:</span> <span class="pl-c1">625.000</span> KB)</pre></div>
<p dir="auto">It seems the type of <code class="notranslate">a</code> isn't inferred.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="   _       _ _(_)_     |
  (_)     | (_) (_)    |  A fresh approach to technical computing
   _ _   _| |_  __ _   |
  | | | | | | |/ _` |  |  Version 0.0.0-prerelease
  | | |_| | | | (_| |  |  Commit 335d1ef401 (2012-03-04 23:47:29)
 _/ |\__'_|_|_|\__'_|  |
|__/                   |

julia&gt; x = 5
5

julia&gt; typeof(x)
Int64

julia&gt; typeof([i | i = 1:5])
Array{Int64,1}"><pre class="notranslate"><code class="notranslate">   _       _ _(_)_     |
  (_)     | (_) (_)    |  A fresh approach to technical computing
   _ _   _| |_  __ _   |
  | | | | | | |/ _` |  |  Version 0.0.0-prerelease
  | | |_| | | | (_| |  |  Commit 335d1ef401 (2012-03-04 23:47:29)
 _/ |\__'_|_|_|\__'_|  |
|__/                   |

julia&gt; x = 5
5

julia&gt; typeof(x)
Int64

julia&gt; typeof([i | i = 1:5])
Array{Int64,1}
</code></pre></div>
<p dir="auto">So far, so good.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="julia&gt; typeof([i | i = 1:x])
Array{Any,1}"><pre class="notranslate"><code class="notranslate">julia&gt; typeof([i | i = 1:x])
Array{Any,1}
</code></pre></div>
<p dir="auto">Wat.<br>
(with apologies to <a href="https://www.destroyallsoftware.com/talks/wat" rel="nofollow">https://www.destroyallsoftware.com/talks/wat</a>)</p>