# SE-0475: Transactional Observation of Values

**URL:** <https://forums.swift.org/t/se-0475-transactional-observation-of-values/79224>\
**Category:** Proposal Reviews\
**Created:** [April 11, 2025, 1:56am UTC](https://forums.swift.org/t/se-0475-transactional-observation-of-values/79224 "2025-04-11T01:56:25Z")\
**Posts on this page:** 1\
**Showing post:** 38

<div class="post-metadata">

**Author:** ![Matt\_Gallagher](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/matt_gallagher/32/2685_2.png) [@Matt\_Gallagher](https://forums.swift.org/u/Matt_Gallagher)\
**Post date:** [May 13, 2025, 5:13am UTC](https://forums.swift.org/t/se-0475-transactional-observation-of-values/79224/38 "2025-05-13T05:13:01Z")

</div>

Unfortunately, I think the current implementation is subject to a serious race condition and shouldn't be merged.

Any changes that occur in the producer while the iterator is _between_ calls to `next` **are lost**. [I described the scenario in which this occurs during the pitch phase, here](https://forums.swift.org/t/pitch-transactional-observation-of-values/78315/19) but you can also get the same problem by adding a `try? await Task.sleep(for: .seconds(1.0))` after the `print` line in the first example in the `Behavioral Notes` section of the proposal – all values after the first will be lost and no matter how long the iterator waits, it will never receive another value.

I think this is the same problem discussed by @jamieQ in the previous reply.

The proposal mentions values that "slip between isolations" – which would be fine if these were simply _aggregated_. But from the point an iterator is constructed, it should _always_ know that some kind of value change has occurred, so that when `next` is called again, it can take the "prime the pump" path. Instead, the iterator is completely unaware and potentially every value in the sequence after the first may be lost.

I'm not sure how you'd maintain tracking of value changed between calls to next but without it, I can't see this being usable. It is just a deadlock waiting to happen.

---

_[View the full topic](https://forums.swift.org/t/se-0475-transactional-observation-of-values/79224)._
