[Pitch] Task Pools

I like the changes! It makes the proposal more focused on what we actually need to solve right now vs. nice to have things further down the road :+1:

2 Likes

Thanks everyone for the pitch comments; Looking forward to the review, by which time we'll put up a complete implementation of the scoped-down version Cory just explained, cheers :tada:

2 Likes

Given that child task results are discarded when discardResults: true, would you ever use it with anything but Void for ChildTaskResult? And if you wouldn’t, should that be encoded in the method signatures? Something like:

	public func withDiscardingTaskGroup<GroupResult>(
	  returning returnType: GroupResult.Type = GroupResult.self,
	  body: (inout TaskGroup<Void>) async -> GroupResult
	) async -> GroupResult {
	
	public func withDiscardingThrowingTaskGroup<GroupResult>(
	  returning returnType: GroupResult.Type = GroupResult.self,
	  body: (inout ThrowingTaskGroup<Void, Error>) async throws -> GroupResult
	) async rethrows -> GroupResult 

The answer is "probably not", but in principle you could: you'd just be dropping them on the floor. I'd be curious what @Douglas_Gregor thinks about new method names but the same type name.