<p dir="auto">It would be convenient to have more iterable unpacking.</p>
<p dir="auto">Julia 1.7:</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; x, (ys...) = (1,2,3,4);
julia&gt; x, ys
(1, (2, 3, 4))
julia&gt; x, (ys...), z = (1,2,3,4)
ERROR: syntax: invalid &quot;...&quot; on non-final assignment location &quot;ys&quot; around REPL[2]:1"><pre class="notranslate">julia<span class="pl-k">&gt;</span> x, (ys<span class="pl-k">...</span>) <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>);
julia<span class="pl-k">&gt;</span> x, ys
(<span class="pl-c1">1</span>, (<span class="pl-c1">2</span>, <span class="pl-c1">3</span>, <span class="pl-c1">4</span>))
julia<span class="pl-k">&gt;</span> x, (ys<span class="pl-k">...</span>), z <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>)
ERROR<span class="pl-k">:</span> syntax<span class="pl-k">:</span> invalid <span class="pl-s"><span class="pl-pds">"</span>...<span class="pl-pds">"</span></span> on non<span class="pl-k">-</span>final assignment location <span class="pl-s"><span class="pl-pds">"</span>ys<span class="pl-pds">"</span></span> around REPL[<span class="pl-c1">2</span>]<span class="pl-k">:</span><span class="pl-c1">1</span></pre></div>
<p dir="auto">Python (<a href="https://www.python.org/dev/peps/pep-3132/#specification" rel="nofollow">feature specification</a>):</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="In [1]: x, *y, z = [1,2,3,4]

In [2]: x, y, z
Out[2]: (1, [2, 3], 4)"><pre class="notranslate"><span class="pl-v">In</span> [<span class="pl-c1">1</span>]: <span class="pl-s1">x</span>, <span class="pl-c1">*</span><span class="pl-s1">y</span>, <span class="pl-s1">z</span> <span class="pl-c1">=</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-v">In</span> [<span class="pl-c1">2</span>]: <span class="pl-s1">x</span>, <span class="pl-s1">y</span>, <span class="pl-s1">z</span>
<span class="pl-v">Out</span>[<span class="pl-c1">2</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>)</pre></div>
<p dir="auto">Sometimes I find myself wanting to do something like</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="(data..., p1, p2) = function_call()"><pre class="notranslate">(data<span class="pl-k">...</span>, p1, p2) <span class="pl-k">=</span> <span class="pl-c1">function_call</span>()</pre></div>
<p dir="auto">because <code class="notranslate">function_call</code> returns many values, but I really only need to separate out the last one or two because, e.g., I will just splat the first however many values into another function call. Granted, I could accomplish this with</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="x = function_call()
(data, p1, p2) = (x[1:end-2], x[end-1:end]...)"><pre class="notranslate">x <span class="pl-k">=</span> <span class="pl-c1">function_call</span>()
(data, p1, p2) <span class="pl-k">=</span> (x[<span class="pl-c1">1</span><span class="pl-k">:</span><span class="pl-c1">end</span><span class="pl-k">-</span><span class="pl-c1">2</span>], x[<span class="pl-c1">end</span><span class="pl-k">-</span><span class="pl-c1">1</span><span class="pl-k">:</span><span class="pl-c1">end</span>]<span class="pl-k">.</span><span class="pl-k">..</span>)</pre></div>
<p dir="auto">but I like the idea of having a concise syntax to do that.</p>
<p dir="auto">(I see that <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="12238823" data-permission-text="Title is private" data-url="https://github.com/JuliaLang/julia/issues/2626" data-hovercard-type="issue" data-hovercard-url="/JuliaLang/julia/issues/2626/hovercard" href="https://github.com/JuliaLang/julia/issues/2626">#2626</a> touched on this, but I wasn't entirely sure what the conclusion was.)</p>
<p dir="auto">It could also be cool to have this for method definitions too, e.g.,</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function f(x..., y)
    # code here; x contains 0 or more arguments
end"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">f</span>(x<span class="pl-k">...</span>, y)
    <span class="pl-c"><span class="pl-c">#</span> code here; x contains 0 or more arguments</span>
<span class="pl-k">end</span></pre></div>
<p dir="auto">One could argue that I should just reorder my arguments, but if, for example, I'm defining an infix operator reordering arguments might not be ideal. For example, <code class="notranslate">|&gt;</code> could be defined as</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="|&gt;(x..., f) = f(x...)"><pre class="notranslate"><span class="pl-k">|&gt;</span>(x<span class="pl-k">...</span>, f) <span class="pl-k">=</span> <span class="pl-c1">f</span>(x<span class="pl-k">...</span>)</pre></div>
<p dir="auto">and then instead of, e.g.,</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="computation() |&gt; args -&gt; g(args...) # g takes two arguments, computation returns two results"><pre class="notranslate"><span class="pl-c1">computation</span>() <span class="pl-k">|&gt;</span> args <span class="pl-k">-&gt;</span> <span class="pl-c1">g</span>(args<span class="pl-k">...</span>) <span class="pl-c"><span class="pl-c">#</span> g takes two arguments, computation returns two results</span></pre></div>
<p dir="auto">I could do</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="computation()... |&gt; g # no anonymous function needed"><pre class="notranslate"><span class="pl-c1">computation</span>()<span class="pl-k">...</span> <span class="pl-k">|&gt;</span> g <span class="pl-c"><span class="pl-c">#</span> no anonymous function needed</span></pre></div>
<p dir="auto">(Admittedly, defining an infix operator with not exactly two arguments probably doesn't make the most sense in most cases.)</p>
<p dir="auto">I'd be interested to hear of other potential use cases, and to hear whether it's even possible to allow slurping in this way.</p>