See ya, async!
See ya, async!
See ya, async!
2021-09-17

The discussion evolves

I'm back with another report on investigating core.async in Trunk. My thread on clojureverse has evolved quite a bit, with interested contributions, including some from the prolific and prodigious Borkdude (who has helped me on more than one occasion). The conversation has evolved into a discussion on the merits of what's possible with core.async in contrast to using a library like promesa. I temporarily considered using promesa; I like the idea of avoiding using a complex library like core.async (and for some of the suggested arguments, including that I would be essentially embedded another event loop inside the JavaScript event loop). But before I could do that, Borkdude pointed out that there is a sqlite library that is synchronous (and purportedly better). I had come across better-sqlite-3 in my readings on callbacks in the Mapbox SQLite-3 library for Node, but had not noticed that it was not asynchronous. I did notice that it posited better benchmarks (up to 10x faster in some cases) - I filed it away in my mind as a possible thing to refactor to in the future in the case that my database rigging was not efficient or ended up being slow.

Refactoring

In the span of a short evening coding session (and an early morning one the next day), I quickly refactored to using the new library. Just like that, all my concerns with asynchronicity were gone. Funny. This latest refactor has brought up questions along with answers, however.

First off, I'm still very glad that I posted my question. I've been meaning to get a better grasp of core.async. Further, I was happy to hear some folks discuss and debate its merits and challenges, especially in the JavaScript world. I learned a fair bit and in a short time I also noticed some of the challenges with it (notably, the challenge of debugging inside the go block).

Back to it!