Hidden syntax of `@concurrent` closure?

Hi, I just run across this user doc at Documentation. I realized in the first example there was a syntax I've never seen before.

func doSomethingElsewhere<T>(_ value: T) {
  Task { @concurrent in   // <<<<<<<<< HERE
    print(value)
  }
}

I checked swift-evolution/proposals/0461-async-function-isolation.md at main · swiftlang/swift-evolution · GitHub, and this @concurrent closure syntax is not mentioned in it.

I'll be glad if this syntax is official.

1 Like

There isn't new syntax for closures introduced by SE-0461—that's just where attributes go in a closure expression:

closure-expression{ attributes ? closure-signature ? statements ? }

2 Likes

Thanks for pointing this out.

I understand this spelling is structurally correct form a parser's perspective, but it does not naturally mean any valid attribute for functions is also valid on closures (like @discaradableResult, @available).

I thought somewhere in the official documents out there, the semantics of @concurrent closures must be mentioned, at least briefly, but I cannot find it. To my understanding, this is a brand new way to mark a closure to be non-isolated, which was not possible before.