<p dir="auto">Just like <code class="notranslate">isequal(x)</code> returns a function which compares to <code class="notranslate">x</code>, it would be nice that <code class="notranslate">isa(T)</code> returned a function which can be used to test if a value is of type <code class="notranslate">T</code>, that is:</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="isa(::Type{T}) where {T} = x -&gt; isa(x, T)"><pre class="notranslate"><span class="pl-en">isa</span>(<span class="pl-k">::</span><span class="pl-c1">Type{T}</span>) <span class="pl-k">where</span> {T} <span class="pl-k">=</span> x <span class="pl-k">-&gt;</span> <span class="pl-c1">isa</span>(x, T)</pre></div>
<p dir="auto">(A user cannot define this method since <code class="notranslate">isa</code> is a built-in function).</p>
<p dir="auto">It would be nice to have a single argument <code class="notranslate">isa</code> for cleaner filtering code.</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="filter(x -&gt; !isa(x, AbstractFloat), [1, 2.0])
# could become
filter(!isa(AbstractFloat), [1, 2.0])"><pre class="notranslate"><span class="pl-c1">filter</span>(x <span class="pl-k">-&gt;</span> <span class="pl-k">!</span><span class="pl-c1">isa</span>(x, AbstractFloat), [<span class="pl-c1">1</span>, <span class="pl-c1">2.0</span>])
<span class="pl-c"><span class="pl-c">#</span> could become</span>
<span class="pl-c1">filter</span>(<span class="pl-k">!</span><span class="pl-c1">isa</span>(AbstractFloat), [<span class="pl-c1">1</span>, <span class="pl-c1">2.0</span>])</pre></div>
<p dir="auto">This would provide some consistency with other functions, such as <code class="notranslate">isequal</code>, but since <code class="notranslate">isa</code> is a builtin function, defining other variants doesn't seem trivial.</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; Core.isa(::Type{T}) where {T} = (x) -&gt; isa(x, T)
ERROR: cannot add methods to a builtin function"><pre class="notranslate">julia<span class="pl-k">&gt;</span> Core<span class="pl-k">.</span><span class="pl-en">isa</span>(<span class="pl-k">::</span><span class="pl-c1">Type{T}</span>) <span class="pl-k">where</span> {T} <span class="pl-k">=</span> (x) <span class="pl-k">-&gt;</span> <span class="pl-c1">isa</span>(x, T)
ERROR<span class="pl-k">:</span> cannot add methods to a builtin <span class="pl-k">function</span></pre></div>