4 ms·
I’ve been fascinated by coroutine code for ages – this was a great read. For one of the best work projects I’ve done, I used Redux-Saga. It was so elegant for
by tkcranny 2y ago
I’ve been fascinated by coroutine code for ages – this was a great read.
For one of the best work projects I’ve done, I used Redux-Saga. It was so elegant for a heavily live-updating ui app. Using coroutines for making API requests, watching sockets, sending and receiving updates, and reacting to data conflicts felt so natural and all just came together so beautifully.
The term he uses for “turning functions inside out” is spot on for how they feel. In particular, the way a good coroutine only focuses on the pure state, while being independent of side effects and even time itself really expanded my view of code. It made testing and reasoning about logic so much easier too. It’s a model I really wish was more widespread in languages and the industry.