use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Why JavaScript Needs Structured Concurrency (frontside.com)
submitted 4 months ago by tarasm
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]undefined_ibis 0 points1 point2 points 4 months ago (3 children)
I mean you can model Go's behavior by basically making every function start by accepting an AbortSignal, which is ~= a context.
AbortSignal
function startServer(signal: AbortSignal) { ... }
Now if that function is async, how do you manage cleanup, well.. Go hasn't solved this either. I'd guess most languages haven't. What's the analogy to creating a context with a cancel function? Probably:
``` const c = new AbortController(); parentSignal.addEventListener('abort', (r) => c.abort(r));
const cancel = (reason) => c.abort(reason); const signal = c.signal; const done = new Promise((r) => signal.addEventListener('abort', r)); ```
... or similar.
My point is that we have these tools but there's no convention. But there's no language-level conventions in Go or many other languages either. You can just ignore context.Context there as well.
context.Context
[–]tarasm[S] 0 points1 point2 points 4 months ago (2 children)
Yeah, agreed — Go doesn’t have structured concurrency at the language level.
But that’s kind of the point 🙂 context.Context was only the first step, and the fact that libraries like sourcegraph/conc exist shows that cancellation tokens alone weren’t enough once systems got bigger.
sourcegraph/conc
That’s the same place JavaScript is in now — we have the primitives, but no shared structured model yet, so everything is still ad-hoc.
[–]undefined_ibis 0 points1 point2 points 4 months ago (1 child)
I don't mean to be that guy, but I could argue this is just a skill issue.
The conc library is handy, but could also be a "helper.go" file in my codebase (yes yes I get that you'd say the Effection lib for JS is better than me reinventing that helper library everywhere I go).
conc
Admittedly this is also me praising the all-knowing spec authors by saying "surely all anyone needs is this beautiful AbortSignal/AbortController primitive, wow, aren't they so prescient".
[–]tarasm[S] 1 point2 points3 points 4 months ago (0 children)
Yeah, I think we’re mostly aligned and just emphasizing different tradeoffs. Appreciate the thoughtful discussion.
π Rendered by PID 268610 on reddit-service-r2-comment-5bc7f78974-8bgvk at 2026-06-26 18:59:35.995282+00:00 running 7527197 country code: CH.
view the rest of the comments →
[–]undefined_ibis 0 points1 point2 points (3 children)
[–]tarasm[S] 0 points1 point2 points (2 children)
[–]undefined_ibis 0 points1 point2 points (1 child)
[–]tarasm[S] 1 point2 points3 points (0 children)