Re:Show HN: Ts-Chan – Go-Like Concurrency Primitives for Typ...
by yunohn on Monday November 06, 2023 @03:24AM
(#38160021)
In addition to my other comment, I agree with the parent here. I appreciate the attempt to mirror golang’s naming, but it would be vastly more readable if you used Channel instead of Chan, etc.
With receives, there's a value attached, and that presents some difficulties regarding typing (for TypeScript).
You have given me an idea, however: I _might_ be able to wrangle together a mechanism that avoids making it a two-step deal (get the index, then resolve the type). It'd probably support only a subset of the functionality, though.
It's on my list to add a simple example to the README using the `Chan` class. Communicating with a single channel (with or without abort support) is very simple, and I'm happy with the API for that.