<p dir="auto">If I have <code class="notranslate">abstract Foo</code> and <code class="notranslate">type Bar&lt;:Foo ... end</code>, <code class="notranslate">type Baz&lt;:Foo ... end</code>, how should I denote a <code class="notranslate">Vector</code> accepting only any <em>subtypes themselves</em> (not instances) of <code class="notranslate">Foo</code> type?</p>
<p dir="auto">This trick works:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="typealias FooType{T&lt;:Foo} Type{T}
v = Vector{FooType}
push!(v, Bar)
push!(v, Baz)
push!(v, Real) # throws an error as expected"><pre class="notranslate"><code class="notranslate">typealias FooType{T&lt;:Foo} Type{T}
v = Vector{FooType}
push!(v, Bar)
push!(v, Baz)
push!(v, Real) # throws an error as expected
</code></pre></div>
<p dir="auto">But it would be nice to express that in-place, like <code class="notranslate">Vector{Type{T&lt;:Component}{T}}</code> (not sure about concrete syntax, but you've got an idea)</p>
<p dir="auto">Currently, there is the following line in the sparse matmult code:</p>
<p dir="auto"></p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/JuliaLang/julia/blob/056b374919e11977d5a8d57b446ad1c72f3e6b1d/base/sparse/linalg.jl#L94-L95">julia/base/sparse/linalg.jl</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 94 to 95
      in
      <a data-pjax="true" class="commit-tease-sha" href="/JuliaLang/julia/commit/056b374919e11977d5a8d57b446ad1c72f3e6b1d">056b374</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L94" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="94"></td>
          <td id="LC94" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> For compatibility with dense multiplication API. Should be deleted when dense multiplication</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L95" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="95"></td>
          <td id="LC95" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> API is updated to follow BLAS API.</span> </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">I am assuming that this means we want to have the more general <code class="notranslate">A_mul_B*!(α,A,B,β,C) = αAB + βC</code> methods which overwrite <code class="notranslate">C</code> (the BLAS <code class="notranslate">gemm</code> API) for dense arrays. Is that still the case? (It also seems possible to keep both APIs, i.e. keep the <code class="notranslate">A_mul_B*!(C,A,B)</code> methods, which would simply be defined as <code class="notranslate">A_mul_B*!(C,A,B) = A_mul_B*!(1,A,B,0,C)</code>.)</p>
<p dir="auto">I would personally like to have the <code class="notranslate">gemm</code> API defined for all array types (this has been expressed <a href="https://github.com/JuliaLang/julia/issues/5332#issuecomment-40901008" data-hovercard-type="issue" data-hovercard-url="/JuliaLang/julia/issues/5332/hovercard">elsewhere</a>). Implementing these methods for dense arrays seems fairly simple, since they would just directly call <code class="notranslate">gemm</code> et al. The sparse case is already implemented. The only real modification would be to the pure julia <a href="https://github.com/JuliaLang/julia/blob/056b374919e11977d5a8d57b446ad1c72f3e6b1d/base/linalg/matmul.jl#L486">generic matmult</a>, which does not accept <code class="notranslate">α</code> and <code class="notranslate">β</code> arguments.</p>
<p dir="auto">This would lead to generic code that works with any type of array/number. I currently have a simple implementation of expm (after having done the modification to <code class="notranslate">_generic_matmatmult!</code>) which works with bigfloats and sparse arrays.</p>