简体   繁体   English

Clojure core.async和Lamina

[英]Clojure core.async and Lamina

Is core.async a replacement to Lamina or does it intend to become a replacement for Lamina? core.async是Lamina的替代品还是打算成为Lamina的替代品?

If not, are there clear situations where one is preferable over the other? 如果没有,是否有明显的情况,哪一个优于另一个?

I'm the author of Lamina. 我是Lamina的作者。 I think core.async is a well-made library, with a lot more clarity in its design than Lamina. 我认为core.async是一个制作精良的库,其设计比Lamina更清晰。 There are things that I think Lamina is better at, mostly related to introspection, performance, and extensibility. 有些事情我认为Lamina更擅长,主要与内省,表现和可扩展性有关。

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. 我对core.async的一个大问题是,除了流抽象之外,它还带来了一个执行模型(一切都发生在core.async线程池中),这意味着如果你在任何地方使用它,它会限制设计和实现代码库中的其他所有内容。

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. 我已经看到了许多“异步”库,它们将流作为core.async通道公开,这意味着如果您习惯使用core.async执行模型,则只能使用这些库。

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 . 我即将发布一个试图成为“最小”流表示的库,可用于代替称为Manifold的core.async,Lamina,Java阻塞队列等。 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. 可以将流形流强制转换为core.async通道,Lamina通道等,并且可以将这些任何内容强制转换为流形流。

I think the "async" landscape is still quite young, and there are a lot of unexplored problems wrt 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. JVM提供了许多用于内省的工具,但由于异步机制使用完全不同的执行模型,我们基本上从头开始重新开始。 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. 我不会告诉你在core.async上使用Lamina,但我要提醒的是,core.async是一个应用程序级抽象,而不是库级抽象。

core.async and Lamina are two different projects and they aren't intended to replace each other. core.asyncLamina是两个不同的项目,它们并不打算互相替换。 Actually, they could play nicely together -if you want to-. 实际上,他们可以很好地一起玩 - 如果你想 - 。
Lamina is a stream oriented approach, while core.async is message oriented. Lamina是面向流的方法,而core.async是面向消息的。

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. 在Lamina中,重要的是为通道定义的回调,而在core.async中,channel和go块是分离的,这是更灵活和模块化的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM