Blog of Frontside, a consultancy behind Effection, writing about structured concurrency, generators and async/await in JavaScript.
HN commenters link it to argue that generators beat async/await, and point to Effection and the team's Backstage consulting work.
I think React would get better developer experience and performance if they adopt language coroutine feature to implement direct style algebraic effect. In fact the React Fiber system is already an implementation of algebraic effect.[1] However, it’s “suspending” a routine by raising an exception. Thus unwinding all the call stack, therefore, it needs to re-run that same routine on resume. This is the core reason why they have a performance issue and why they created the compiler to cache values on reruns.
JavaScript has language level coroutine features like async/await or yield/yield* and we have seen libraries using these features to implement direct style algebraic effect. For example Effect[2] and Effection[3]. You don’t need to memoize things if the language runtime can suspend and resume your functions instead of throwing exceptions and rerun them.
[1]: https://youtu.be/7GcrT0SBSnI
[2]: https://effect.website/
[3]: https://frontside.com/effection/
Indeed, Backstage is a framework for creating a developer portal, not a ready-made product.
I used to work on a consultancy (https://frontside.com) who's specializing in adopting Backstage at Fortune 500s like HP. When you adopt Backstage at scale, you rely on processors that scan your LDAP, GitHub, etc to discover, stitch, and feed cohesive data to the software catalog. HP is giving a talk next month on how they manage 100,000+ entities in Backstage.
Backstage does a lot of heavy lifting that I'd rather use than have to build from scratch.
JavaScript generators are unmined gold! We've done a lot of usage of JavaScript generators as delimited continuations; using them to implement the classic shift/reset operations in JavaScript. https://github.com/thefrontside/continuation
Built on those delimited continuations is structured concurrency for JavaScript (https://frontside.com/effection)
Hi! Charles has a great article about why it's better to use generators over async/await:
https://frontside.com/blog/2023-12-11-await-event-horizon/
There are real benefits to using generators over async/await so I would encourage everyone to learn more about them and their benefits.
Have a look at effection,which seems to share some ideas: https://frontside.com/effection