promises-aplus / promises-spec

An open standard for sound, interoperable JavaScript promises—by implementers, for implementers.
https://promisesaplus.com/
Creative Commons Zero v1.0 Universal
1.84k stars 171 forks source link

Proposal: Make clear in the spec that the Promise constructor runs the provided function body immediately #225

Closed SetTrend closed 8 years ago

SetTrend commented 8 years ago

I often feel confused by the fact that the Promise constructor automatically launches the executor function with the next event loop (e.g. by executing process.nextTick()).

The fact that constructing a Promise object is synonymous to "immediately" running the Promise's function body doesn't seem natural to me. The fact that this happens only becomes clear by lack of such a thing like a Promise(...).Start() method.

I believe it should be made clear in the specification that constructing a Promise object automatically runs the Promise's code immediately with the next event loop.

domenic commented 8 years ago

The Promise constructor is not specced here.