# Isolation Assumptions

**URL:** <https://forums.swift.org/t/isolation-assumptions/69514>\
**Category:** Pitches\
**Created:** [January 18, 2024, 11:52am UTC](https://forums.swift.org/t/isolation-assumptions/69514 "2024-01-18T11:52:48Z")\
**Posts on this page:** 1\
**Showing post:** 56

<div class="post-metadata">

**Author:** ![Nickolas\_Pohilets](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/nickolas_pohilets/32/10659_2.png) [@Nickolas\_Pohilets](https://forums.swift.org/u/Nickolas_Pohilets)\
**Post date:** [March 4, 2024, 10:17pm UTC](https://forums.swift.org/t/isolation-assumptions/69514/56 "2024-03-04T22:17:30Z")

</div>

Going through the thread, I’ve got one more idea, which is related, but probably deserves a separate proposal.

So far, discussion have reached a stage where original problem is solved by passing isolating actor as a parameter.

But what if that is not possible. What if we want to infer the isolating actor from `self`. If reference is isolated to a connected region from the moment of allocation, it should be possible.

And it can be expressed using an initializer isolated to an actor parameter.

But we somehow need to pass that isolated actor parameter from initializer to the instance method.

My idea is to allow `isolated` keyword to be applied to stored read-only properties:

```swift
class NonSendableType {
    private var internalState = 0
    private let actor: isolated (any Actor)

    init(actor: isolated (any Actor)) {
        self.actor = actor
    }

    init(another: (any Actor)) {
        self.actor = another // Error: isolated stored property is initialized by a non-isolated value
    }
    
    func doSomeStuff() {
        // self is known to be isolated to self.actor
        // so current method must be isolated to self.actor too
	Task {
	    let value = await otherType.getAValue()

	    // hop back to self.actor
	    self.internalState += value // ok
        }
    }
}

```

---

_[View the full topic](https://forums.swift.org/t/isolation-assumptions/69514)._
