lampepfl / gears

A strawman for a low-level async library in Scala 3.
https://lampepfl.github.io/gears/
Apache License 2.0
254 stars 25 forks source link

Async.select should be Async.race #30

Closed nadenf closed 10 months ago

nadenf commented 10 months ago

The term select in programming is used when a user explicitly picks something from a list. For example, select a column from a table.

In the Async.select example it is not the user choosing a Future it is the gears library. And it's hidden from the user what the criteria is that determines which Future is being selected.

The better term is in fact Async.race which is clear and obvious.

SethTisue commented 10 months ago

closed on purpose?

nadenf commented 10 months ago

@SethTisue .. Yes. I didn't realise there actually was an Async.race. And select is what is used in Rust.

natsukagami commented 10 months ago

Yes, both select and race are present. Select works as expected if you came from Go, Rust or Kotlin; while race provides you a way to combine sources into a racing source (that could itself be raced). They're sitting at different levels of abstraction and friendliness of use imo.