Stream: platform development

Topic: What is the current status for platform development


view this post on Zulip Henrik Larsson (Sep 24 2025 at 11:37):

I would like to try to make a Rust platform. Is this a good time to try or should I wait?. Are there any recent docs for how to go about making a platform other than looking at existing once?

view this post on Zulip Anton (Sep 24 2025 at 13:35):

Hi @Henrik Larsson,

Is this a good time to try or should I wait?

We are planning some changes to platforms with the the new compiler but I'm not sure how big those will be @Luke Boswell

Are there any recent docs for how to go about making a platform other than looking at existing once?

No docs for this yet, basic-webserver and basic-cli are probably the best examples for a rust platform.

view this post on Zulip Luke Boswell (Sep 24 2025 at 23:23):

@Henrik Larsson you can build a rust platform today using the existing Roc compiler toolchain. If the goal is to experiment with ideas or build a proof of concept, and you're not looking to publish releases etc then I think that's ok.

There are definitely some oddeties and things to work around - but if you can fork an existing platform and make minor modifications you should be fine. I'm happy to assist a little -- though I've been really focussed on getting the new Zig compiler online.

We have solid examples in basic-cli, basic-webserver, basic-ssg, or my template roc-platform-template-rust.

Another approach that side-steps a lot of challenges is letting the cargo drive the linking etc (have Roc generate an object file). A good example is roc-ray. I think this is a good option for now, it's not as nice an experience if your wanting to make a release to share with others.

We intentionally haven't published any guides or documentation because the ABI and between the host and roc is a little different with our new compiler. We redesigned it based on our experience with the goal to have something much nicer.

If you are ok waiting a couple of months, I think after we've ported basic-cli etc to the new compiler we will have good examples, nice docs, and generally a much easier configuration for platform development.

So I'd say it's definitely possible to build nice Rust platforms today - but it requires fairly advanced Roc knowledge and systems level rust skills.

Let me know what you decide :smiley:

view this post on Zulip Henrik Larsson (Sep 25 2025 at 04:54):

Awsome. Thanks for the info. I think I will just wait and keep an eye here for progress. What are the plans for the hot code reloading. Will this be a very development focused thing or will you be able to do hot code reload in production systems also?

view this post on Zulip Brendan Hansknecht (Sep 25 2025 at 05:10):

We plan for the dev builds to run with an interpreter. So we should be able to make it automatically pick up changes with a flag if a user wants that.

view this post on Zulip Brendan Hansknecht (Sep 25 2025 at 05:10):

I don't think there are any plans for a release build to do something similar

view this post on Zulip Luke Boswell (Sep 25 2025 at 06:06):

I think 95% of the design for hot code reloading is already implemented and in main. If you checkout the Int test platform that is working e2e.

For hot code reloading specifically ... I think** all that remains is to implement the part where the roc cli detects the file has changed using the watcher (which I think already exists??) and the rebuilds the ModuleEnv and restarts the child host-interpreter executable.

** I'm really fuzzy on how it's actually going to work

view this post on Zulip Luke Boswell (Sep 25 2025 at 06:09):

Maybe I'm getting confused with fast dev builds -- just rebuilding/restarting the app is currently like on the order of 10's of milliseconds.

view this post on Zulip Luke Boswell (Sep 25 2025 at 06:11):

We've thrown ideas around for something like roc-dom where instead of using inter-process communication you can stream the newly built app to a host running in the browser (for example) and then reload/restart. In theory it should be possible for the host to detect if the "Model" has changed and possibly re-use the old app state.

@Richard Feldman forgive me if I'm butchering this explanation :sweat_smile:


Last updated: Oct 18 2025 at 12:13 UTC