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

Promise API #66

Closed
azjezz opened this issue Sep 30, 2020 · 6 comments
Closed

Promise API #66

azjezz opened this issue Sep 30, 2020 · 6 comments
Labels
Status: Completed Nothing further to be done with this issue. Awaiting to be closed by the requestor out of politeness Type: Enhancement Most issues will probably ask for additions or changes.
Milestone

Comments

@azjezz
Copy link
Owner

azjezz commented Sep 30, 2020

implement promises according to the Promises/A+ open standard.

@azjezz azjezz added Priority: Medium This issue may be useful, and needs some attention. Status: Available No one has claimed responsibility for resolving this issue. Type: Enhancement Most issues will probably ask for additions or changes. hacktoberfest labels Sep 30, 2020
@azjezz azjezz added this to the v1.0.0 milestone Sep 30, 2020
@veewee
Copy link
Collaborator

veewee commented Sep 30, 2020

Promises sound nice as well, but there are many packages out there already... Does it make a lot of sense to implement it again from scratch (which is a lot of hard work) instead of using amphp or react promises and coroutines? (Which are quite nice and have the async event loops covered through multiple extensions with vanilla PHP callbacks etc.)

@azjezz
Copy link
Owner Author

azjezz commented Sep 30, 2020

I'm not really sure about this, the question should be: "does it make sense to have promises in a standard library", the issue is we cannot use Amphp, or ReactPHP here, as PSL should not have any dependencies except for PHP itself and core/bundled/external extensions ( we shouldn't rely on PECL extensions as well, see: https://www.php.net/manual/en/extensions.membership.php ). 🤔

@WyriHaximus
Copy link

As long as it has a then method we at @reactphp can support it. (Assuming you're wrapping it through our resolve function.)

@azjezz
Copy link
Owner Author

azjezz commented Sep 30, 2020

I believe guzzle does the same, so I'm closing this as Psl\Result\ResultInterface will have a then method ( see discussion at #65 ), which mean it can act as a promise to some extent.

@azjezz azjezz closed this as completed Sep 30, 2020
@azjezz azjezz added Status: Completed Nothing further to be done with this issue. Awaiting to be closed by the requestor out of politeness and removed hacktoberfest Priority: Medium This issue may be useful, and needs some attention. Status: Available No one has claimed responsibility for resolving this issue. labels Sep 30, 2020
@veewee
Copy link
Collaborator

veewee commented Oct 1, 2020

Wow, that's nice! Did not know react could do that!

@WyriHaximus
Copy link

@veewee Yup, only thing is that we assume it is a pure promise with no side effects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Completed Nothing further to be done with this issue. Awaiting to be closed by the requestor out of politeness Type: Enhancement Most issues will probably ask for additions or changes.
Projects
None yet
Development

No branches or pull requests

3 participants