Git Product home page Git Product logo

Comments (4)

neurosnap avatar neurosnap commented on August 17, 2024

This is one area that I feel pretty confident saying: users are not going to want to think about converting their promises into operations everytime they want to activate one inside a DC. It's not that much of a lift to support officially and the ergonomics make a ton of sense.

The bigger issue for me is supporting both safe and unsafe call() functionality. I built a safe() function that is the same as call() but wraps the call inside a Result type. This is extremely useful for cases where a user wants to run parallel operations and collect the results (e.g. starfx parallel).

It works but integrating both into a single API seems better.

from effection.

cowboyd avatar cowboyd commented on August 17, 2024

This is one area that I feel pretty confident saying: users are not going to want to think about converting their promises into operations everytime they want to activate one inside a DC. It's not that much of a lift to support officially and the ergonomics make a ton of sense.

I agree, and our test cases we actually do this https://github.com/thefrontside/effection/blob/v3/test/suite.ts#L7-L16 However, I am very nervous about monkey-patching the global Promise prototype.

Is opt-in going to be still too awkward? Maybe we make it opt-out?

It works but integrating both into a single API seems better.

How would we integrate this into a single call() API since the type of the return value is of a different for safe calls?

from effection.

neurosnap avatar neurosnap commented on August 17, 2024

However, I am very nervous about monkey-patching the global Promise prototype.

Why do we need to monkey-patch? starfx has call() that supports promises oob. What about that don't you like?

from effection.

cowboyd avatar cowboyd commented on August 17, 2024

Oh, I thought you were saying we should be able to yield to promises

yield* someAsyncFunction();

vs

yield* call(someAsyncFunction());

from effection.

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.