Hey there. Just starting out writing some roc and starting to write a platform in Rust. Just curious, are there any thoughts/plans on composing platforms? I'm doing some networking things and realizing I also want cli stuff. Feels like in my dream world I would be able to pull in basic_cli to do cli things and my own networking thing to do networking things.
I'm aware I could "compose" things on the platform side in the platform language, just thinking I would like to do it on the Roc side.
Edit: I guess after reading https://github.com/roc-lang/roc/blob/main/docs/mini-tutorial-new-compiler.md
it's clear the intent is exactly one platform, no combining multiple. Leaving this topic here just for additional discussion.
welcome @Daniel Dombrowsky! :smiley:
you're far from alone in asking this question! It's one of the most-discussed topics on Zulip and we have a FAQ entry for it too
Thanks for the link, makes sense. One of the things drawing me in is that I think the platform concept is cool and unique. So it tracks that like so many things there's a tradeoff.
The ideal thing would be that platforms only provide basic functionality like file/socket I/O and concurrency (scheduling, messaging), and everything on top is written in Roc in a platform-agnostic way.
If we had a platform agnostic Roc HTTP library, that could be used with a simple socket in basic-cli, but also with any other platform that provides socket primitives.
The current basic-webserver does the HTTP in Rust, that's why it's not composable.
However, for native Roc features to work, concurrency is required in many cases (for example, to handle multiple requests concurrently in a pure Roc HTTP library). There is no full-featured concurrency in any platform currently.
#ideas > Concurrent/threaded platforms
It's being explored, but it needs work.
Platforms are not just a simple FFI alternative, but much more. Different platforms can implement different styles of I/O, concurrency, memory management, etc.
It doesn't help if two platform components are both written in Zig if they use different memory management and I/O practices. It's not only about the language.
I think of platforms like if they are like libc for C.
Of course, if Roc is used e.g. as an extension language for a game or an editor, the platform has the main functionality, and Roc is just a small part.
But an extension environment requires different Roc packages than a whole app or a server.
notramo said:
I think of platforms like if they are like
libcfor C.
this is one way to think of them, but there are many others! :smile:
e.g. game engine platform
or "your entire existing large app in another code base is the platform, and you just want to inject a bit of roc into it"
platforms can be all shapes and sizes
is a related thread.
Last updated: Oct 15 2026 at 17:56 UTC