reactphp / promise

Promises/A implementation for PHP.
https://reactphp.org/promise/
MIT License
2.38k stars 146 forks source link

[RFC] Remove `some()`, `map()`, `reduce()` functions #219

Closed clue closed 2 years ago

clue commented 2 years ago

This simple PR suggests removing the some(), map(), reduce() functions to reduce the API surface. With these changes applied, our API is pretty much identical to ES6 promises commonly used in JavaScript. This makes our APIs appear less complex and thus easier to understand.

Empirical evidence suggests these functions aren't used very commonly in our ecosystem either, so I'd rather use the chance to clean up our API surface with the upcoming Promise v3 release. I don't currently see a prominent need for these functions, but I'm open to the idea of reintroducing them later if needed. There's reason to believe that these functions could (should?) exist as part of our new reactphp/async package, especially considering how it mimics part of async.js.

I'm filing this as an RFC to get more feedback on these functions and to see how others feel about this. If this gets merged, I'll file a follow-up PR to deprecate these functions for Promise v2 to ease upgrading.

Refs #35

clue commented 2 years ago

Rebased to resolve merge conflict now that #220 is in :shipit: