@ArrayBuilder in swift-collections?

Some good discussion in this pitch this week about introducing an official @ArrayBuilder implementation to the ecosystem:

What’s the process for proposing additions to swift-collections? Is this in scope for the collections package?

Adding an @ArrayBuilder to swift-collections would still accomplish all of the goals from the pitch:

  • Initializing array values is such a common operation that this addition will be relevant to many Swift projects.
  • Including @ArrayBuilder in a core package like swift-collections enables it to become a standard best practice across the Swift ecosystem.
  • Standardizing on a single, high-quality, optimized, official implementation reduces fragmentation and improves the quality of the overall ecosystem.
10 Likes

I have two potential issues:

  • My biggest worry is the prospect of adding a macro target or a dependency to swift-collections. (People are using this package in a variety of weird/unsupported ways, and the slightest deviation from the basic build setup will cause problems.)

  • Second, the feature should probably be more flexible -- it should allow creating instances other than an Array. Perhaps this feature should be integrated into the design work for the generalization of ExpressibleByArrayLiteral?

2 Likes