The technical reason is the same as for any other feature that depends on introducing new types: Swift does not have a reasonable mechanism for back-deploying new types. Functions can be easily back-deployed, but types are prohibitively difficult.
They did go to a lot of effort to back deploy Swift Concurrency, after all.
The scale of the effort to back-deploy Swift Concurrency was huge. It was important for Swift Concurrency because adopting the model fully requires rearchitecting some parts of your app, which cannot be done behind @available
or #if
available, and the benefits to adopting the concurrency model throughout the ecosystem were large.
Unless we solve the problem that types are hard to back-deploy, e.g., by extending the @backDeploy
attribute from SE-0376 to types, back deployment of new types will remain extremely difficult.
However, it seems to me not too laborious to add to the compiler a new kind of transformation to the result builders that takes the body of the function to which it is applied as a closure.
I think this is going in the wrong direction. The fundamental issue is about back-deployment of types, and you can't get anywhere without solving that. As for the specific result-builder feature, we'd need to see a number of other use cases before we extend result builder further.
Doug