<p dir="auto">I can't think of a reason why this method shouldn't be added, but I may be missing something.</p>
<p dir="auto">I wonder whether <code class="notranslate">collect()</code> isn't always equivalent to <code class="notranslate">Vector()</code>, and could therefore be merged into it:</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; methods(collect)
#3 methods for generic function &quot;collect&quot;:
collect(r::Range{T&lt;:Any}) at range.jl:753
collect{T}(::Type{T}, itr) at array.jl:217
collect(itr) at array.jl:224"><pre class="notranslate">julia<span class="pl-k">&gt;</span> <span class="pl-c1">methods</span>(collect)
<span class="pl-c"><span class="pl-c">#</span>3 methods for generic function "collect":</span>
<span class="pl-c1">collect</span>(r<span class="pl-k">::</span><span class="pl-c1">Range{T&lt;:Any}</span>) at range<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">753</span>
<span class="pl-c1">collect</span><span class="pl-c1">{T}</span>(<span class="pl-k">::</span><span class="pl-c1">Type{T}</span>, itr) at array<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">217</span>
<span class="pl-c1">collect</span>(itr) at array<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">224</span></pre></div>
<p dir="auto">The method for <code class="notranslate">Range</code> returns a vector, so it could be replaced with <code class="notranslate">Array()</code>, as both call <code class="notranslate">vcat()</code> in the end. <code class="notranslate">convert(Vector, ...)</code> currently fails and should be fixed.</p>
<p dir="auto">The methods for general iterables are more complex, but they essentially always create an <code class="notranslate">Array</code> too. Even when they call <code class="notranslate">similar()</code>, it's on a <code class="notranslate">1:1</code> range, so they actually create a <code class="notranslate">Vector</code>. So the <code class="notranslate">collect()</code> machinery could be moved to <code class="notranslate">Array()</code>/<code class="notranslate">Vector()</code> to make them support conversion from any iterable.</p>
<p dir="auto">This issue is related to discussions regarding <code class="notranslate">similar()</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="112908187" data-permission-text="Title is private" data-url="https://github.com/JuliaLang/julia/issues/13731" data-hovercard-type="issue" data-hovercard-url="/JuliaLang/julia/issues/13731/hovercard" href="https://github.com/JuliaLang/julia/issues/13731">#13731</a>). Indeed, Julia provides a few functions which appear to behave differently, but in practice behave like <code class="notranslate">Array</code>, and callers end up depending on this assumption. This makes the API more complex and less explicit.</p>
<p dir="auto">See also <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="96373202" data-permission-text="Title is private" data-url="https://github.com/JuliaLang/julia/issues/12251" data-hovercard-type="issue" data-hovercard-url="/JuliaLang/julia/issues/12251/hovercard" href="https://github.com/JuliaLang/julia/issues/12251">#12251</a> about merging <code class="notranslate">full</code> into <code class="notranslate">Array</code>.</p>