I found the ScalaSTM Homepage says 'We have chosen to make
TSet.View.iterator return an iterator over an atomic snapshot of the collection. The
iterator method acts as if it has made a copy of the entire collection and returned an iterator over the copy. Concurrent updates can proceed uninhibited.'
I am wondering if this method is reasonable because I think the copy of the iterator may not represent the current keyset in the object. For example, after you copy the iterator, a transaction adds a key in TMap, and then you return the iterator. This iterator is old.
BTW, is it possible to share the implementation code for TMap iterator? I only found the interface in the project.