While this makes sense, it seems to me like another option would be to have async
replace await
directly in an expression, instead of modifying let
.
That is why was a syntax like the following not considered:
func makeDinner() async throws -> Meal {
let veggies = try async chopVegetables()
let meat = async marinateMeat()
let oven = try async preheatOven(temperature: 350)
let dish = Dish(ingredients: await [veggies, meat])
return await try oven.cook(dish, duration: .hours(3))
}
3 Likes