<p dir="auto">It seems that reloading or including a file or package causes multiple, duplicate method listings to be stored and/or displayed.  When I'm working on a package or file that defines types and methods, I find that if I load changes with <code class="notranslate">reload</code> or <code class="notranslate">include</code> and then call <code class="notranslate">methods</code> on one of my methods, I get multiple listings of the same method/signature.  It also seems that when I call the method, I don't necessarily get the most recent version.</p>
<p dir="auto">The code below is a minimal example of this behavior. I have observed this behavior with julia 0.3.4, 0.3.5, and 0.3.6 on OSC Mavericks (10.9.5).</p>
<p dir="auto">Create this file:</p>
<h1 dir="auto">File: "dup.methods.jl"</h1>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="module Dups                                                                                                                                                                                                                                 

import Base: splice!
export splice!

type Foo
     thing::Int
end

function splice!(x::Foo,i,item)
         Foo.thing = 5
end

end"><pre class="notranslate"><code class="notranslate">module Dups                                                                                                                                                                                                                                 

import Base: splice!
export splice!

type Foo
     thing::Int
end

function splice!(x::Foo,i,item)
         Foo.thing = 5
end

end
</code></pre></div>
<p dir="auto">Then reload it a few times and list the methods on <code class="notranslate">splice!</code>.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="julia&gt; include(&quot;dup.methods.jl&quot;)

julia&gt; include(&quot;dup.methods.jl&quot;)
Warning: replacing module Dups

julia&gt; include(&quot;dup.methods.jl&quot;)
Warning: replacing module Dups

julia&gt; include(&quot;dup.methods.jl&quot;)
Warning: replacing module Dups

julia&gt; methods(splice!)
#12 methods for generic function &quot;splice!&quot;:
splice!(a::Array{T,1},i::Integer) at array.jl:598
splice!(a::Array{T,1},i::Integer,ins::AbstractArray{T,N}) at array.jl:598
splice!{T&lt;:Integer}(a::Array{T,1},r::UnitRange{T&lt;:Integer}) at array.jl:614
splice!{T&lt;:Integer}(a::Array{T,1},r::UnitRange{T&lt;:Integer},ins::AbstractArray{T,N}) at array.jl:614
splice!(B::BitArray{1},i::Integer) at bitarray.jl:724
splice!(B::BitArray{1},r::Union(Integer,UnitRange{Int64})) at bitarray.jl:735
splice!(B::BitArray{1},r::Union(Integer,UnitRange{Int64}),ins::BitArray{1}) at bitarray.jl:735
splice!(B::BitArray{1},r::Union(Integer,UnitRange{Int64}),ins::AbstractArray{Bool,1}) at bitarray.jl:772
splice!(x::Foo,i,item) at /Users/phaverty/dup.methods.jl:11
splice!(x::Foo,i,item) at /Users/phaverty/dup.methods.jl:11
splice!(x::Foo,i,item) at /Users/phaverty/dup.methods.jl:11
splice!(x::Foo,i,item) at /Users/phaverty/dup.methods.jl:11

julia&gt; "><pre class="notranslate"><code class="notranslate">julia&gt; include("dup.methods.jl")

julia&gt; include("dup.methods.jl")
Warning: replacing module Dups

julia&gt; include("dup.methods.jl")
Warning: replacing module Dups

julia&gt; include("dup.methods.jl")
Warning: replacing module Dups

julia&gt; methods(splice!)
#12 methods for generic function "splice!":
splice!(a::Array{T,1},i::Integer) at array.jl:598
splice!(a::Array{T,1},i::Integer,ins::AbstractArray{T,N}) at array.jl:598
splice!{T&lt;:Integer}(a::Array{T,1},r::UnitRange{T&lt;:Integer}) at array.jl:614
splice!{T&lt;:Integer}(a::Array{T,1},r::UnitRange{T&lt;:Integer},ins::AbstractArray{T,N}) at array.jl:614
splice!(B::BitArray{1},i::Integer) at bitarray.jl:724
splice!(B::BitArray{1},r::Union(Integer,UnitRange{Int64})) at bitarray.jl:735
splice!(B::BitArray{1},r::Union(Integer,UnitRange{Int64}),ins::BitArray{1}) at bitarray.jl:735
splice!(B::BitArray{1},r::Union(Integer,UnitRange{Int64}),ins::AbstractArray{Bool,1}) at bitarray.jl:772
splice!(x::Foo,i,item) at /Users/phaverty/dup.methods.jl:11
splice!(x::Foo,i,item) at /Users/phaverty/dup.methods.jl:11
splice!(x::Foo,i,item) at /Users/phaverty/dup.methods.jl:11
splice!(x::Foo,i,item) at /Users/phaverty/dup.methods.jl:11

julia&gt; 
</code></pre></div>
<p dir="auto">Note the one entry of <code class="notranslate">splice!(x::Foo,i,item)</code> for each <code class="notranslate">include</code> call. This happens with proper packages and with <code class="notranslate">reload</code> as well. I believe that using <code class="notranslate">reload</code> is what is recommended in the "workflow" section of the documentation. Please correct me if I'm just doing it wrong.</p>
<p dir="auto">It would be nice to have a clearly defined <code class="notranslate">AbstractSparseArray &lt;: AbstractArray</code> with an interface that defines where the non-zero values are, and that way generic looping over sparse arrays can be defined. Special matrix types like <code class="notranslate">Tridiagonal</code> should fall under <code class="notranslate">AbstractSparseArray</code> to allow for generic sparse iteration, and then it would make it easier for things like <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/dlfivefifty/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/dlfivefifty">@dlfivefifty</a> 's BandedMatrices.jl to plug into a more generic system of sparsity support.</p>