Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clojure core.async and Lamina

Is core.async a replacement to Lamina or does it intend to become a replacement for Lamina?

If not, are there clear situations where one is preferable over the other?

like image 864
shmish111 Avatar asked Nov 07 '14 12:11

shmish111


2 Answers

I'm the author of Lamina. I think core.async is a well-made library, with a lot more clarity in its design than Lamina. There are things that I think Lamina is better at, mostly related to introspection, performance, and extensibility.

The big problem I have with core.async is that in addition to a stream abstraction, it brings along an execution model (everything happens on the core.async thread pools), which means that if you use it anywhere, it constrains the design and implementation of everything else in your codebase.

I've seen a number of "async" libraries made that expose streams as core.async channels, which means that you can only use the libraries if you're comfortable using the core.async execution model.

I'm about to release a library that tries to be a "minimal" stream representation that can be used in place of core.async, Lamina, Java blocking queues, etc. called Manifold. A Manifold stream can be coerced to a core.async channel, Lamina channel, and so on, and any of these things can be coerced back into a Manifold stream.

I think the "async" landscape is still quite young, and there are a lot of unexplored problems w.r.t. how well the abstractions scale, how easy they are to debug in production, and so on. The JVM provides a lot of tools for introspection, but since the async mechanisms use a complete different execution model we're basically starting over again from scratch. I wouldn't tell you to use Lamina over core.async, but I would caution that core.async is an application-level abstraction, not a library-level one.

like image 144
ztellman Avatar answered Oct 17 '22 06:10

ztellman


core.async and Lamina are two different projects and they aren't intended to replace each other. Actually, they could play nicely together -if you want to-.
Lamina is a stream oriented approach, while core.async is message oriented.

Which one to use is up to you. In Lamina, the important thing is the callbacks you define for the channel, while in core.async, channels and go blocks are decoupled, and this is more flexible and modular.

like image 42
Chiron Avatar answered Oct 17 '22 05:10

Chiron