swift-async-algorithms
swift-async-algorithms copied to clipboard
`Task.select` naming
Task.select seems too general and doesn't really indicate that the first task to complete is chosen. I've seen (and have used myself) Task.race on the forums, which I think more aptly represents the underlying action.
Task.race was one of the first considerations; but even though that is a term of art, it infers a race-condition which it explicitly avoids. select was chosen to its similarity to the C api select. That particular API is one that we feel is perhaps (from a functionality standpoint) something that belongs a bit lower than this package. I would like to see it be pitched as an addition to the _Concurrency library - and of course naming should most certainly be part of that discussion.
Historically speaking another consideration was Task.first.
Right, race does have a more negative connotation, but select still feels unclear. Task.first, though, seems like a great name.
I’d like to suggest Task.winner
Hi everyone
Task.select: is not super explicit on what it does (regarding selecting the first task that finished)
Task.first: could be misleading because it takes several tasks as parameters, and first could refer to the first arg.
Task.winner: is explicit and well suited. I vote for this one.
We removed Task.select since it encouraged the usage of unstructured concurrency; hence, closing this issue.