<p dir="auto">Finalizer is currently define to be <code class="notranslate">finalizer(x, function)</code>.<br>
But (I assert that) it should be  <code class="notranslate">finalizer(function, x)</code><br>
as this allows do-block syntax to define the function.</p>
<p dir="auto">Right now I must write</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="function finalize_state(st)
        close(st.pending)
        close(st.complete)
end
finalizer(state, finalize_state)"><pre class="notranslate"><code class="notranslate">function finalize_state(st)
        close(st.pending)
        close(st.complete)
end
finalizer(state, finalize_state)
</code></pre></div>
<p dir="auto">Where as if it took the function as first argument,<br>
like <code class="notranslate">map</code>, <code class="notranslate">filter</code>, (Dict) <code class="notranslate">get!</code> and  <code class="notranslate">remotecall</code>  (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="79689044" data-permission-text="Title is private" data-url="https://github.com/JuliaLang/julia/issues/11406" data-hovercard-type="issue" data-hovercard-url="/JuliaLang/julia/issues/11406/hovercard" href="https://github.com/JuliaLang/julia/issues/11406">#11406</a>)<br>
I could be writing:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="finalizer(state, finalize_state) do st
        close(st.pending)
        close(st.complete)
end"><pre class="notranslate"><code class="notranslate">finalizer(state, finalize_state) do st
        close(st.pending)
        close(st.complete)
end
</code></pre></div>
<p dir="auto">I suggest deprecating, and creating the new overload.</p>
<hr>
<p dir="auto">I wonder if it isn't worth search through the whole of Base and Core looking for methods that take functions (or things that look like functions), as a non-first parameter, then I could raise just one issue for all of them (or do PR)<br>
(I could script that pretty easy using <code class="notranslate">parse</code>)</p>
<p dir="auto">To be consistent with other APIs and allow the use of do-block syntax, the finalizer argument to <code class="notranslate">finalizer</code> should be the first argument, not the second.</p>