Heraclitus Slays Zalgo
This is a 5-minute lightning talk I gave at Fullstack Fest 2018, which combines my trademark uneducated armchair philosphy with some JS jargon.
The Greek philosopher Heraclitus once said:
Upon those that step into the same river, different and again different waters flow.
In this talk, I discuss how the problem of “releasing Zalgo” (h͢e̴ ̵wh͝o ẁa̧i̛t̕s͟ ̵b͠ȩhi̷n̡d t͡h̵e͡ ͡wall) when working with APIs that are unpredicably asynchronous no longer applies when using Promises. Since correct use of a
Promise involves lifting all operations that depend on the resolved value into the context of the value (using
.then()), your program cannot end up in an inconsistent state. This is in contrast to earlier approaches, such as using callbacks, that would have involved modifying outside state (a mutable identity) that is referred to by other parts of the program, thus creating the potential for a race condition.
Apologies up-front that I’m not particularly polished or easy to follow here. I decided to do this talk on a whim, and it essentially became a brain-dump of things I had been thinking about recently ¯\(ツ)/¯
Here are the articles and talks I refer to:
- Are We There Yet?, by Rich Hickey
- Designing APIs for Asynchrony, by Isaac Schlueter
- Intentionally unleashing Zalgo with synchronous promises, by Daniel Brain