title: A bug of mutable.Set.foreach in scala?
body: <p>I'm using scala 2.9.1, when I try this code:</p>
  
  <pre><code>import scala.collection.mutable
  val a = mutable.Set(1,2,3,4,7,0,98,9,8)
  a.foreach(x =&gt; { println(x); a.remove(x) })
  </code></pre>
  
  <p>the result was something like</p>
  
  <pre><code>0
  98
  2
  1
  4
  3
  8
  </code></pre>
  
  <p>which did not list all the elements of a. After this, a becomes Set(9, 7) instead of empty set. It looks very weird to me, is it a bug or we just cannot modify the set itself when doing foreach?</p>