Not a bad description, but it’s always annoying to me when the “core” bits of promises are conflated with the syntax sugar bits. The idea that any X is a Promise is a bit silly. It’s useful in a dynamic language, but it makes the semantics and ideas messy. It’d be better to say simply
1. A promise is a container of eventual values.
2. Any value we have now we can resolve "eventually"
3. A promise containing a promise can be flattened into a single promise
4. Layers of promises are often automatically flattened via (3)
5. Values which are returned where promises are expected are often automatically resolved via (2)
(1-3) are distinct from (4-5). (1-3) are essentially the monad laws while (4-5) are just tricks JS does to make having no type information more bearable.
Not a bad description, but it’s always annoying to me when the “core” bits of promises are conflated with the syntax sugar bits. The idea that any X is a Promise is a bit silly. It’s useful in a dynamic language, but it makes the semantics and ideas messy. It’d be better to say simply
(1-3) are distinct from (4-5). (1-3) are essentially the monad laws while (4-5) are just tricks JS does to make having no type information more bearable.