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

add Async::Promise #371

Closed
wants to merge 3 commits into from
Closed

add Async::Promise #371

wants to merge 3 commits into from

Conversation

paddor
Copy link
Contributor

@paddor paddor commented Jan 27, 2025

This is a draft to fix #370

@ioquatix
Copy link
Member

ioquatix commented Jan 28, 2025

  • Missing documentation for reject and rejected?.

On the surface, I'm okay with this change. However, I am not sure I want to merge it yet.

I wonder if resolved? should return true if the variable was rejected. At least, that feels more natural to me e.g. from a usage point of view. The point of such a method is to control level signalling, e.g. https://github.com/socketry/async-http/blob/e2598452c5d014623cee16b451f1cb84e4e74f27/lib/async/http/protocol/http1/finishable.rb#L18

I wonder if we should encourage users just to use Async in the case they need a full-blown promise style interface.

Maybe the code above can be simplified with this change.

I would like to explore this further.

@paddor paddor changed the title Variable: add #reject, #rejected? and raise in #wait add Async::Promise Jan 28, 2025
@paddor
Copy link
Contributor Author

paddor commented Jan 28, 2025

I've extracted the feature into Async::Promise. If necessary, we could release this in another gem.

@ioquatix ioquatix force-pushed the main branch 2 times, most recently from 21527ca to 37ca738 Compare January 30, 2025 00:02
@paddor paddor closed this Jan 30, 2025
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

Successfully merging this pull request may close these issues.

Async::Variable#reject or maybe Async::Promise
3 participants