xtodo js promise
This puzzled me for a decade. Node js non-blocking/async 2012, fad or progress? In fact, most programer don't know it before node js made it popular in around 2010. But it exists in programing languages, in niche tasks of io/events/threads coding.
js promise
- For computer scientists.
- JS promise, the most complicated thing.
- I still don't fully understand it.
- Am relating it to call with continuation and concurrency issues.
- I need to understand and explain it in terms of loop and check.
- If you do, explain please.
- I likely won't get good answers. but i'll grade your answer, and explain the flaws.
- Alternatively, what is analogous feature in other programing language? Any?
- What is its history?
- This would also explain and put a judgement of controversy about non-blocking in nodejs 15 years ago.
- actually, gonna try asking grok.
- Basically what I'm looking for is to explain JS's promise in terms of lambda calculus, or an implementation in a basic turing complete programming language, such as basic bash or Python.
- The history goes back to MochiKit implementing Twisted (a Python library) Deferreds in JS.
- Dojo Toolkit borrowed the concept from MochiKit (I think MochiKit's author donated the code to Dojo).
- Promises ended up being a subset of Deferred functionality.
- Links to follow:
- Also, @kriszyp, @slightlylate, @phiggins, @dylans, @ttrenka, and many others I can't remember were instrumental in getting Deferreds and Promises into JS 20+ years ago.
- It was an honor working with them back then.
- Manuel Simoni
- @msimoni
- Fundamentally, it's a way to make callbacks (which is the only way you can do IO in JS) more palatable, by wrapping them in a convenient object.
- There's quite a bit going on; look into a pure-JS implementation of the "Promises/A+" spec such as this one:
- https://github.com/abdulapopoola/Adehun/blob/master/adehun.js
promisesaplus
dojo Deferred