Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand on motivation #3

Open
dminor opened this issue Jul 25, 2024 · 2 comments
Open

Expand on motivation #3

dminor opened this issue Jul 25, 2024 · 2 comments

Comments

@dminor
Copy link

dminor commented Jul 25, 2024

The motivation given here is mostly from the Async Iterator Helpers proposal. We'd like to see more examples, in particular, of how it would be used outside of iterator helpers.

Some questions that came up in our proposal review discussion:

  • Why add a general interface instead of just making this part of iterator helpers?
  • On the other hand, is this only being proposed to be part of the language to work well with iterator helpers? This seems like it could easily be a library, other than wanting it to work with the iterator helpers.

Fwiw, I think the now subsumed semaphore proposal did a better job on motivation.

@dminor
Copy link
Author

dminor commented Jul 25, 2024

Thinking about a little more, I'd also be interested in hearing why we're investigating in this direction and not adding an Atomics.Semaphore for example.

@Jamesernator
Copy link

Jamesernator commented Jul 27, 2024

  • Why add a general interface instead of just making this part of iterator helpers?

Not a proposal author, but speaking generally having an interface here is useful as Semaphore by itself doesn't cover all possible concurrency strategies.

A pretty common example would be dynamic capacity, where some other part of the code measures throughput and changes the internal capacity of some semaphore-like "governor" until throughput is (approximately) maximized. (Honestly I feel most uses in promise based code would want this over a fixed size semaphore, but a widely applicable API shape here seems tricky to design).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants