title: Strange, unexpected behavior (disappearing/changing values) when using Hash default value, e.g. Hash.new([])
body: <p>Consider this code:</p>
  
  <pre><code>h = Hash.new(0)  # New hash pairs will by default have 0 as values
  h[1] += 1  #=&gt; {1=&gt;1}
  h[2] += 2  #=&gt; {2=&gt;2}
  </code></pre>
  
  <p>That’s all fine, but:</p>
  
  <pre><code>h = Hash.new([])  # Empty array as default value
  h[1] &lt;&lt;= 1  #=&gt; {1=&gt;[1]}                  ← Ok
  h[2] &lt;&lt;= 2  #=&gt; {1=&gt;[1,2], 2=&gt;[1,2]}      ← Why did `1` change?
  h[3] &lt;&lt; 3   #=&gt; {1=&gt;[1,2,3], 2=&gt;[1,2,3]}  ← Where is `3`?
  </code></pre>
  
  <p>At this point I expect the hash to be:</p>
  
  <pre><code>{1=&gt;[1], 2=&gt;[2], 3=&gt;[3]}
  </code></pre>
  
  <p>but it’s far from that. What is happening and how can I get the behavior I expect?</p>