<p dir="auto"><a href="https://groups.google.com/forum/#!topic/julia-users/8S41r1KjdC4" rel="nofollow">https://groups.google.com/forum/#!topic/julia-users/8S41r1KjdC4</a></p>
<p dir="auto">How about not emitting this warning in the case where the variable name used twice is <code class="notranslate">_</code>? I'm not proposing making <code class="notranslate">_</code> special in any other way – just skipping this warning for it.</p>
<p dir="auto">It'd be convenient to have a designated dummy variable <code class="notranslate">_</code> (actually keyword), which would simply ignore everything stored into it. For example, you often want to deconstruct tuples like so</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="a, _, b, _, c = f()"><pre class="notranslate"><code class="notranslate">a, _, b, _, c = f()
</code></pre></div>
<p dir="auto">where the <code class="notranslate">_</code> values are uninteresting. Likewise, one may want to ignore function arguments, like so</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="function foo(a, _, b, _, c)
    return (a, b, c)
end"><pre class="notranslate"><code class="notranslate">function foo(a, _, b, _, c)
    return (a, b, c)
end
</code></pre></div>
<p dir="auto">This is actually a syntax error right now, because two arguments have the same name, which makes sense if you actually want to read their values. The idea here is to instead discard them, and reading the value of <code class="notranslate">_</code> would be a syntax error.</p>
<p dir="auto">In theory, this is purely about code readability: when one sees <code class="notranslate">_</code>, one knows that the value is not used and thus won't need to be thought about any further; OTOH if one sees something else, then the value is probably going to be used further down the line and needs to be kept track of. One also won't need to behold the unsightly output of wetware gensym() implementations in unused function argument names. In practice though, there is also a performance difference with the current compiler:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="function f1(x1, x2, x3, x4, x5)
    a, _, b, _, c = x1, x2, x3, x4, x5
    return (a, b, c)
end

function f2(x1, x2, x3, x4, x5)
    return (x1, x3, x5)
end

code_native(f1, (Int, String, Int, Int, Int))
code_native(f2, (Int, String, Int, Int, Int))"><pre class="notranslate"><code class="notranslate">function f1(x1, x2, x3, x4, x5)
    a, _, b, _, c = x1, x2, x3, x4, x5
    return (a, b, c)
end

function f2(x1, x2, x3, x4, x5)
    return (x1, x3, x5)
end

code_native(f1, (Int, String, Int, Int, Int))
code_native(f2, (Int, String, Int, Int, Int))
</code></pre></div>
<p dir="auto">The assembly for f2 is significantly shorter.</p>