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