Giter Club home page Giter Club logo

Comments (8)

Bilge avatar Bilge commented on June 13, 2024

See https://github.com/amphp/amp/blob/3.x/src/Future/functions.php. You probably want awaitAll().

from amp.

vudaltsov avatar vudaltsov commented on June 13, 2024

@Bilge , no, I want a function that immediately returns a single Future, not awaited result.

from amp.

Bilge avatar Bilge commented on June 13, 2024

I have no idea what you're talking about.

from amp.

vudaltsov avatar vudaltsov commented on June 13, 2024

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.

vudaltsov avatar vudaltsov commented on June 13, 2024

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.

vudaltsov avatar vudaltsov commented on June 13, 2024

@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.

kelunik avatar kelunik commented on June 13, 2024

You can wrap it in async() if you really need that, but we use futures rarely with fibers, only when necessary.

from amp.

vudaltsov avatar vudaltsov commented on June 13, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.