<p dir="auto">If I paste this function in the REPL and hit one of the arrow keys, the first line is duplicated.</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function f(io::IO, s)
    print(io, &quot;StringDecoder from $(F()) to $(T()) wrapping $(s.istream)&quot;)
end"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">f</span>(io<span class="pl-k">::</span><span class="pl-c1">IO</span>, s)
    <span class="pl-c1">print</span>(io, <span class="pl-s"><span class="pl-pds">"</span>StringDecoder from <span class="pl-v">$(<span class="pl-c1">F</span>())</span> to <span class="pl-v">$(<span class="pl-c1">T</span>())</span> wrapping <span class="pl-v">$(s<span class="pl-k">.</span>istream)</span><span class="pl-pds">"</span></span>)
<span class="pl-k">end</span></pre></div>
<p dir="auto">i.e. I get this:</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; function f(io::IO, s)
julia&gt; function f(io::IO, s)
           print(io, &quot;StringDecoder from $(F()) to $(T()) wrapping $(s.istream)&quot;)
       end"><pre class="notranslate">julia<span class="pl-k">&gt;</span> <span class="pl-k">function</span> <span class="pl-en">f</span>(io<span class="pl-k">::</span><span class="pl-c1">IO</span>, s)
julia<span class="pl-k">&gt;</span> <span class="pl-k">function</span> <span class="pl-en">f</span>(io<span class="pl-k">::</span><span class="pl-c1">IO</span>, s)
           <span class="pl-c1">print</span>(io, <span class="pl-s"><span class="pl-pds">"</span>StringDecoder from <span class="pl-v">$(<span class="pl-c1">F</span>())</span> to <span class="pl-v">$(<span class="pl-c1">T</span>())</span> wrapping <span class="pl-v">$(s<span class="pl-k">.</span>istream)</span><span class="pl-pds">"</span></span>)
       <span class="pl-k">end</span></pre></div>
<p dir="auto">Each additional press gives a new duplicated line.</p>
<p dir="auto">I had hoped that indexing a named tuple (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="233271596" data-permission-text="Title is private" data-url="https://github.com/JuliaLang/julia/issues/22194" data-hovercard-type="pull_request" data-hovercard-url="/JuliaLang/julia/pull/22194/hovercard" href="https://github.com/JuliaLang/julia/pull/22194">#22194</a>) with a <code class="notranslate">Symbol</code> would be a type-inferrable operation. I'm guessing that a tfunc or whatever, like for <code class="notranslate">Tuple</code>, may be needed here.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type &quot;?help&quot; for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.7.0-DEV.2400 (2017-11-02 03:12 UTC)
 _/ |\__'_|_|_|\__'_|  |  ajf/empty/5fa163f (fork: 1 commits, 0 days)
|__/                   |  x86_64-linux-gnu

julia&gt; nt = (a=1, b=2.0)
(a = 1, b = 2.0)

julia&gt; f(x) = x[:a]
f (generic function with 1 method)

julia&gt; @code_warntype f(nt)
Variables:
  x::NamedTuple{(:a, :b),Tuple{Int64,Float64}}

Body:
  begin
      return (Base.getfield)(x::NamedTuple{(:a, :b),Tuple{Int64,Float64}}, :a)::Union{Float64, Int64}
  end::Union{Float64, Int64}"><pre class="notranslate"><code class="notranslate">               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.7.0-DEV.2400 (2017-11-02 03:12 UTC)
 _/ |\__'_|_|_|\__'_|  |  ajf/empty/5fa163f (fork: 1 commits, 0 days)
|__/                   |  x86_64-linux-gnu

julia&gt; nt = (a=1, b=2.0)
(a = 1, b = 2.0)

julia&gt; f(x) = x[:a]
f (generic function with 1 method)

julia&gt; @code_warntype f(nt)
Variables:
  x::NamedTuple{(:a, :b),Tuple{Int64,Float64}}

Body:
  begin
      return (Base.getfield)(x::NamedTuple{(:a, :b),Tuple{Int64,Float64}}, :a)::Union{Float64, Int64}
  end::Union{Float64, Int64}
</code></pre></div>