You seem to be picking on q as the standard promise implementation, but it's actually one of the most complex implementation of a promise and does far more than just implement the standard.
If you want to see how a simpler implementation (which just implements promises/A+) would look, I suggest you read https://www.promisejs.org/implementing/ > On 1 Oct 2015, at 02:40, 韩冬 <[email protected]> wrote: > > Yeah, it seemed i do have a hard time to figure out how the state transition > worked from the source code. I always can’t manage state transition in js > clearly, especially under async operations. > >> On Oct 1, 2015, at 8:49 AM, Tab Atkins Jr. <[email protected]> wrote: >> >> On Wed, Sep 30, 2015 at 5:46 PM, 韩冬 <[email protected]> wrote: >>> Now take a look at even a very simple Promise library Q form its design >>> document: https://github.com/kriskowal/q/blob/v1/design/q7.js >>> >>>> The "state machine" isn't complex. "unresolved" goes to either >>>> "resolved to another promise", "fulfilled", or "rejected". "resolved >>>> to another promise" eventually turns into "fulfilled" or "rejected". >>>> Or, of course, hangs, which "unresolved" can also do. >>> >>> With all these state transition added, it’s quiet complex to me to figure >>> out how does it work, i have to go back and read the design process from 1 >>> to 7. >>> Should we expect future js programmers just use it, or understand it before >>> use it? >> >> If you think what I said above, in your quote, is complex, then I >> really can't help you. >> >> ~TJ > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

