4 ms·
This was also asked a year ago, and I pointed to Zach Tellman, and that comment was upvoted by others. I'll post the same again. Because he always has excellent
by lkrubner 10y ago
This was also asked a year ago, and I pointed to Zach Tellman, and that comment was upvoted by others. I'll post the same again. Because he always has excellent reasons for the decisions that he makes, I find it interesting to read his code and try to figure out why he made the decisions that he did. This is in Clojure:
https://github.com/ztellman/manifold/blob/master/src/manifold/stream/async.clj https://github.com/ztellman/manifold/blob/master/src/manifol...
Also, it is fascinating to consider how Go routines were implemented as part of Clojure core. Huey Petersen wrote a fantastic analysis of how state machines were used to implement Communicating Sequential Processes:
http://hueypetersen.com/posts/2013/08/02/the-state-machines-of-core-async/ http://hueypetersen.com/posts/2013/08/02/the-state-machines-...
You can read along while looking at the source code here:
https://github.com/clojure/core.async https://github.com/clojure/core.async
This is a great implementation of Communicating Sequential Processes, first described by Tony Hoare in 1977:
https://en.wikipedia.org/wiki/Communicating_sequential_processes https://en.wikipedia.org/wiki/Communicating_sequential_proce...
This is the same technique that Javascript/NodeJS uses to implement its async.