Comments (8)
See https://github.com/amphp/amp/blob/3.x/src/Future/functions.php. You probably want awaitAll()
.
from amp.
@Bilge , no, I want a function that immediately returns a single Future
, not awaited result.
from amp.
I have no idea what you're talking about.
from amp.
Well, I am talking about a function like React\Promise\all. It returns Promise, not awaited result array like await
in amphp.
Returns a promise that will resolve only once all the items in $promisesOrValues have resolved. The resolution value of the returned promise will be an array containing the resolution values of each of the items in $promisesOrValues.
from amp.
Let me put it this way:
Amp\Future\await()
is callable(iterable<TKey, Future<TValue>>): array<TKey, TValue>
But I want callable(iterable<TKey, Future<TValue>>): Future<array<TKey, TValue>>
from amp.
@Bilge , does it make sense now? I can give an example of problem I am solving.
Here are similar methods/functions in other langiuages: JS, C#. Note that return type is different from Amp\Future\await
or Amp\Future\awaitAll
.
from amp.
You can wrap it in async() if you really need that, but we use futures rarely with fibers, only when necessary.
from amp.
Thank you, @kelunik, that makes sense! After three days of experimenting with amphp 3 I now understand, why await combinators are much more useful.
from amp.
Related Issues (20)
- QUIC support HOT 2
- A concise way of resolving results that may turn out to be Promise, Generator or something else HOT 4
- An object reference sticks in the library HOT 1
- Running an async task in a synchronous application HOT 9
- stream_select hangs forever when FDs > 1024 are used HOT 5
- Getting access to child process data on SIGCHLD in Loop::onSignal. HOT 16
- Confusing diagram in README HOT 6
- Return self in Future::ignore HOT 1
- UnhandledFutureError is hard to debug HOT 2
- Migration guide for combinator functions HOT 5
- FiberError: Cannot switch fibers in current execution context on Laravel HOT 4
- 32 bit PHP: Return value of Amp\Loop\NativeDriver::now() must be of the type int, float returned HOT 5
- Functions should require callable instead of closures HOT 10
- Any way to create or get a context for coroutine. HOT 5
- Version confusion HOT 8
- Shouldn't Future::finally() pass the future data to the provided callback? HOT 7
- Event loop terminated without resuming the current suspension (the cause is either a fiber deadlock, or an incorrectly unreferenced/canceled watcher) HOT 3
- When to not to use `async`?
- Comparison with ReactPHP HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amp.