by eplawless · 3y ago · 0 comments
Honestly, I've been struggling to come up with examples that aren't extremely contrived, but are still self-contained enough to easily demonstrate. It might actually be easier to just document patterns, though.
Unfortunately it is a lot easier to write documentation for an audience that shares the same context / background / experience. The README was written with an audience in mind consisting primarily of those familiar with Go (or more convoluted "communicating sequential processes" implementations), who were frustrated that things that are very easy in Go, are so much harder in JS. It's not something I considered deeply, but I was imagining that it was unlikely that someone would be searching for "channels in JS" without a base level of understanding.
I work/have worked with some pretty talented people, but (in the past) I've found it difficult to convey the value of the sorts of patterns that `ts-chan` is intended to enable, to those without first-hand experience with such patterns.
Documentation is hard :P
I will say though, I personally get the impression that attempts at "concurrency" in JavaScript (in production code) are quite rare, which I attribute to how difficult it is.
That is to say, I don't know if there really _is_ a "default pattern".
[1] https://github.com/joeycumines/ts-chan#the-microtask-queue-a...
That might be completely wrong, but it’s the impression I get when someone says that something the rest of the world uses without issue sucks.
Fair call though, I guess. It doesn't really matter, but I'm certainly used to TypeScript and JavaScript.
That is entirely accurate. I struggle to imagine scenarios in which I’d need two parallel routines to communicate with each other.
Promises are for asynchronous programming, which are not concurrent.