oaktree | nutgrinder | cookiemaker | cookieeater
and as soon as each nut is ready from the oaktree, it can be consumed by the nutgrinder and it can send nut flour to the cookiemaker as its ready and when the cookiemaker has enough nut flour to make a cookie, it can send a cookie to the cookieeater. Four processes, acting in parallel¹ with little friction to make it happen.Now, try to architect this in your favorite programming language.² I did see where Google proposed something (almost a decade ago) for C++ to allow this https://isocpp.org/files/papers/n3534.html although I don’t know where it stands now. I’ve been thinking along something similar for finl for each of its stages so that, e.g., parsing and tokenization doesn’t need to be complete to start formatting, but it would be nice if there were a simple language facility to allow this.
REST APIs also fail at this insofar as you need to wait for a whole request to complete before you get a response rather than being able to send the request and get each chunk of data back as appropriate. We seem to have forgotten so much that we knew thirty years ago.
⸻
1. Although not necessarily. IIRC, good old fashioned DOS pipes would wait until each process was done before opening the next application in the chain.
2. Assuming, of course, that shell scripting isn’t your favorite programming language.