The blocking behavior of basic-cli makes it unsuitable for many projects. Many problems require consuming input from multiple sources at the same time, and immediately reacting when data arrives on any of them.
dinit):see #contributing > Concurrency design for some discussion. I actually just built my own C-based platform that addresses some things that are kinda related to your bullet points, but I have never needed concurrency yet. See https://github.com/showell/shale/tree/master/c/host for a taste. It's a pretty big codebase that I use for Claude to do basically all its tasks. It has its own scripting language for ad hoc scripts, but for things I run often that are Roc-related, most of the logic now lives in Roc.
There is also #ideas > Concurrent/threaded platforms, but those require more planning, and are likely to be done after 0.1.0, or even 1.0.
I renamed the thread title to be more specific, because I meant this thread as brainstorming for some quick, temporary solution, that may be not ideal, but works with the current Roc, and unblocks some use cases, even if the code is not the most elegant.
One solution could be to add a worker!, that is exposed to the platform.
It takes a List(U8), because complex objects are too difficult to pass between threads, but a byte slice can be easily cloned fully. The entry point then would deserialize it from CBOR or JSON.
The spawn! platform call would start a worker, and return a worker ID, probably an integer.
The main! would have a worker ID too, probably 1.
Then the platform would manage some messaging. It would be very simple, probably a List(U8), and the destination ID.
send! : WorkerID, List(U8) => () — send a message.
receive! : () => Try((WorkerID, List(U8)), [Empty]) — receive one message from the inbox of the current worker. WorkerID specifies the sender.
receive_blocking! : () => (WorkerID, List(U8))
The receive! and send! functions would be nonblocking, i.e. send! immediately returns (even if the destination worker is not waiting for messages), and the platform buffers it. receive! would immediately return if there's nothing queued.
Another solution could be adding a select mechanism. Since most of the problems involve reading from multiple file descriptors at once, maybe this would be simpler.
But in the context of Roc, this may turn out to be more difficult.
How to expose an uniform API for HTTP, UDS, and plain files (stdio, filesystem)?
Ideally, it would not need to run Roc lambdas, because that would be similar to #ideas > Concurrent/threaded platforms, which is known to be very complex. I'm not sure how it could be solved without lambdas.
I suspect all of this is gonna be out of scope for basic-cli. Nothing prevents you from building out your own platform. I don't use basic-cli for anything non-trivial. For example, my chat has its own zig platform. My agent tasks that use Roc use the aforementioned C platform.
This will cause fragmentation in the Roc ecosystem in the long term. If I built a custom platform because of this, that would mean that the only reason for building that platform was to add missing functionality. Not innovation in platform technology, e.g. memory management, error handling, io_uring, etc., nor to add support for a currently unsupported OS, hardware, or environment. Just to add a missing function, that provides basic functionality.
This is the wrong reason to build a custom platform.
When projects or libraries get more complex, it's inevitable to use platform types from the library. And since the types are not compatible accross most platforms, it will cause fragmentation or bridges that add unnecessary complexity and friction.
This is the kind of friction that makes people choose another language. There is no other language that says "Hey, you can use our ready-made platform, if you write apps that run sequentially. If you need concurrency, you need to reimplement all of the platform functionality."
These are all fair points, but I think there's benefit to keeping the basic-cli actually basic.
notramo said:
This is the kind of friction that makes people choose another language.
My bias is that I already choose other languages to do a lot of my work. I don't need Roc to solve every problem for me. I find more and more niches for Roc, but I like that Roc plays nice with C, Zig, Odin, and JS, which i all use with Roc.
These are all fair points, but I think there's benefit to keeping the basic-cli actually basic.
Yes. And this is actually basic functionality, that belongs in basic-cli. It's not scripting-cli or barebones-cli. When something is easier to do in bash, than with the current basic-cli platform, it probably indicates that something is lacking.
Steve Howell said:
My bias is that I already choose other languages to do a lot of my work. I don't need Roc to solve every problem for me. I find more and more niches for Roc, but I like that Roc plays nice with C, Zig, Odin, and JS, which i all use with Roc.
I also use Zig. For some problems, Zig is better, for some, it's Roc. Or maybe other languages. The issue is that I can't use Roc for problems where Roc would be the ideal language from every aspect, except for concurrency. I don't want to choose another language that's inferior in every aspect, just because it has this one feature.
Your basic proposal seems reasonable to me under your premises. I think spawn/send/receive/select are well-understood primitives.
Important, that this does not target highly concurrent applications. It's just for unblocking a few more simple use cases. For programs where the entire architecture is based on concurrency, an OTP-like platform would be indeed better suitable.
I just wanted to say that this is an important issue and I am going to come back to it later.
Last updated: Nov 26 2026 at 20:35 UTC