# \`@isolated(any)\` function types

**URL:** <https://forums.swift.org/t/isolated-any-function-types/70562>\
**Category:** Pitches\
**Tags:** concurrency, actors\
**Created:** [March 10, 2024, 11:22pm UTC](https://forums.swift.org/t/isolated-any-function-types/70562 "2024-03-10T23:22:40Z")\
**Posts on this page:** 1\
**Showing post:** 30

<div class="post-metadata">

**Author:** ![hborla](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/hborla/32/27563_2.png) [@hborla](https://forums.swift.org/u/hborla)\
**Post date:** [March 16, 2024, 4:38pm UTC](https://forums.swift.org/t/isolated-any-function-types/70562/30 "2024-03-16T16:38:45Z")

</div>

> [@cal](#):
>
> Could it make sense to also use the `@isolated` annotation to support applying an explicit isolation to a closure? That could let us simplify this example to:
> 
> ```swift
> func delay(operation: @isolated(any) () -> ()) {
> Task { @isolated(operation) in // seems very elegant!
> // ...
> }
> }
> 
> ```
> 
> I find this spelling really appealing because it's more similar to the syntax for isolating a closure to a global actor (both would use an @ annotation: `@MainActor in` and `@isolated(myActor) in`).
> 
> e.g. in this example from earlier, I'd find `@isolated(counter)` to be more intuitive and appealing:
> 
> > [@cal](#):
> >
> > ```swift
> > Task { [isolation counter] in
> > counter.incrementAndAssertCountEquals(iteration)
> > }
> > 
> > ```
> 
> vs
> 
> ```swift
> Task { @isolated(counter) in
> counter.incrementAndAssertCountEquals(iteration)
> }
> 
> ```

This syntax is specified in a separate proposal, which has been pitched over in

> [@Closure isolation control](https://forums.swift.org/t/closure-isolation-control/70378):
>
> Greetings Swift evolvers. For your consideration, I have drafted a proposal allowing for more explicit control over the isolation of closures. You can read the proposal at [nnnn-closure-isolation.md](https://github.com/sophiapoirier/swift-evolution/blob/closure-isolation/proposals/nnnn-closure-isolation-control.md) Please share thoughts and feedback here or as comments on the [pull request](https://github.com/apple/swift-evolution/pull/2322). Thank you.

I think your feedback would be valuable to post in that pitch thread!

---

_[View the full topic](https://forums.swift.org/t/isolated-any-function-types/70562)._
