Stream: beginners

Topic: concurrency


view this post on Zulip Andreas T Jonsson (Aug 15 2022 at 10:13):

Hi!

I'm all new to Roc and I'm trying to get an initial understanding of the language.
There was a lot of great material on the website but I'm curious how multi-threading and concurrency is handled. (or what the plans are)

Is there any material or talk on the subject?
I'm coming from the C & Go side (and I have some experience with Clojure) so it would be great if there are some explanation that target us with a imperative mindset. :)

Very exited about the project in general! <3

view this post on Zulip Anton (Aug 15 2022 at 10:20):

Hi @Andreas T Jonsson, @Brendan Hansknecht has been experimenting with async in this repository.

view this post on Zulip Andreas T Jonsson (Aug 15 2022 at 11:08):

Thanks @Anton !

Much appreciated. I will have a look at those examples.

view this post on Zulip Brendan Hansknecht (Aug 15 2022 at 12:53):

Just to clarify, all of the work is just experiments to see if async await can work with roc at all. The code is messy and maybe not that useful for thinking about general concurrency. Though it was enough to get a basic async web handler with db working.

view this post on Zulip Brendan Hansknecht (Aug 15 2022 at 12:54):

Being a web handler it just doesn't really deal with most of the concurrency work. It is really a set of mostly single threaded code being run by an async executor. Adding go like concurrency features would be a whole nother challenge.

view this post on Zulip Brendan Hansknecht (Aug 15 2022 at 12:58):

But I guess the answer to your question overall is that for the most part multithreading and concurrency are not handled at all by Roc. It is up to the platform to decide how multithreading and concurrency is exposed to Roc. Roc can be set to use atomic refcounts if that is wanted, but otherwise, Roc has no explicit features for this. My async roc web backend, for example, has no way to tell it is actually running async. One could guess based on the fact it returns data and continuations to the platform, but there is no guarantee.


Last updated: Jul 05 2025 at 12:14 UTC