3 ms·
Indenting is a symptom of having to write code structurally, having to tightly couple call side with it's handler. Promises break that structural linkage: we h
by rektide 14y ago
Indenting is a symptom of having to write code structurally, having to tightly couple call side with it's handler.
Promises break that structural linkage: we have the only thing in JS that matters, an object, a first class plain old object, that we can reason with and perform operations on as if it were any other object. It happens to be an object about a future which will one day resolve, but it's just an object.
And because it's an object that can, after it's inception, have handlers added to it, we break the necessary structural linkage that callbacks mandate: we can make callbacks latter, we can condition what callbacks to attach, we can compose or chain more promises after our first promise and put our handler on that... we have a first class thing to work with, not just a function, which expects a fully-readied handler. It defers the need to define handling.
Read more of my comments to get a better sense of why A) I adore promises B) I feel this article is injurous to the case for promises.
- jessaustin 14y agothis article is injurous to the case for promises. Haha I thought the same about the Crockford talk. Can you point me to a non-injurious source?
- jasondenizac 14y agosee also: https://gist.github.com/3889970 https://gist.github.com/3889970