Alternative to Promise

韩冬 handong05 at meituan.com
Thu Oct 1 01:40:02 UTC 2015


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. <jackalmage at gmail.com> wrote:
> 
> On Wed, Sep 30, 2015 at 5:46 PM, 韩冬 <handong05 at meituan.com> 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



More information about the es-discuss mailing list