Promises not being lazy is the number one downside of their design. The reason you always have functions that return promises? You wanted laziness and Promises are eager. (Most people don't realize this)https://twitter.com/andrestaltz/status/963808359542677510 …
-
-
Promises, like functions, are computations, not data structure.
-
Exactly this, promises simply wrap a function that executes some logic and calls a resolve or reject callback, the weirdness here is that it invokes the function immediately. I think promises work fine for what they are, they would just be better if they were lazy.
- 1 more reply
New conversation -
-
-
I think you misunderstood the statement . This would make a Promise lazy: ´´´ new Promise((resolve, reject) => {...}, delayInMilliseconds); ´´´ By nature starts right away. Of course it can be delayed by calling resolve later but its branch function is being revoked immediately.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
& Web Standards TL; Blink API OWNER
Named PWAs w/
DMs open. Tweets my own; press@google.com for official comms.