# Has Swift's concurrency model gone too far?

**URL:** <https://forums.swift.org/t/has-swifts-concurrency-model-gone-too-far/77468>\
**Category:** Using Swift\
**Tags:** concurrency, structured-concurren\
**Created:** [January 26, 2025, 7:31pm UTC](https://forums.swift.org/t/has-swifts-concurrency-model-gone-too-far/77468 "2025-01-26T19:31:36Z")\
**Posts on this page:** 1\
**Showing post:** 92

<div class="post-metadata">

**Author:** ![mattie](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/mattie/32/13267_2.png) [@mattie](https://forums.swift.org/u/mattie)\
**Post date:** [January 31, 2025, 12:16am UTC](https://forums.swift.org/t/has-swifts-concurrency-model-gone-too-far/77468/92 "2025-01-31T00:16:28Z")

</div>

> [@titanlegions](#):
>
> There are many cases where you can't do this. One is if you need something to conform to a protocol that doesn't include the isolation. Sure you can `nonisolate` bits to achieve that sometimes, but often you can't. `Equality` comes up with this a lot. You want to be `@MainActor` but you also want to be `Equatable` based on vars that the isolation would need to cover. You are stuck.

Challenged yes, but not stuck!

This is well-known class of problem called a "[Protocol Conformance Isolation Mismatch](https://www.swift.org/migration/documentation/swift-6-concurrency-migration-guide/commonproblems#Protocol-Conformance-Isolation-Mismatch)". In the case of a MainActor type, my personal favorite solution is a preconcurrency conformance.

```swift
@MainActor
class MyClass {
	var value = 1
}

extension MyClass: @preconcurrency Equatable {
	static func == (lhs: MyClass, rhs: MyClass) -> Bool {
		lhs.value == rhs.value
	}
}

```

It looks weird, because `Equatable` is not actually "preconcurrency", but it expresses the semantics perfectly. It is only meaningful to compare these types when also MainActor-isolated. The ability to constrain a conformance to a specific isolation domain is so handy that this is going come to the language as an "isolated conformance". It's part of the vision document, and one I'm pretty excited about [personally](https://forums.swift.org/t/relaxing-non-isolated-protocol-conformance/74738)!

Now, for actors, the situation gets more complex. There are valid cases for conforming an actor to a protocol with synchronous requirements, but they are limited. This can also be an indication that you have reached for an actor when a non-`Sendable` type is more appropriate. But those are super hard to use in combination with concurrency. Thankfully, that will also be getting way easier, via [isolation inheritance](https://forums.swift.org/t/pitch-inherit-isolation-by-default-for-async-functions/74862) changes.

---

_[View the full topic](https://forums.swift.org/t/has-swifts-concurrency-model-gone-too-far/77468)._
