Will array of async values be possible?

Not an answer to your question (whether it will become a language feature) but the pattern potentially can become a part of the standard library. I have a utility struct called Zip in my library that serves this purpose in case of homogenous actions, and a family of functions zip(...) for non-homogenous ones, see AsyncMux/AsyncMux/Sources/Zip.swift at main · crontab/AsyncMux · GitHub

Example use:

let fv: [() async -> Int]  = [f, g, h]

let results = await Zip(actions: fv)
    .result

results.forEach { print($0) }

(although I only have a throwing version of the above, but you get the idea)

1 Like