Stream: ideas

Topic: Pointless Fun: What BEAMifying Roc would look like?


view this post on Zulip Egemen Göl (Aug 31 2024 at 18:32):

Hi all, loving the split between platforms and applications! Moving all of the IO stuff to a different layer that is very specialized to the task opened my mind to the possibilities that may be.

I would like to hear your opinions about the feasibility or attractiveness of, writing a platform that works like BEAM.
(Taking a lot of inspiration from Lunatic here)

BEAM essentially provides (with a lot of nuance)

BEAM provides much much more than these, but I am only interested in this subset at the moment.

How Roc would look like, if we developed a platform such that:

What would it be like? Would it be theoretically possible? Would it be idiomatic? Would it be desirable?

Especially the part about, is there anything stopping platforms to span multiple machines? Why not we build platforms that look like VMs rather than a regular standard library.

Thanks for your attention in advance, I am a intermediate and grew quite excited :)

Would love opinions of all sorts, best :)

view this post on Zulip Brendan Hansknecht (Aug 31 2024 at 18:53):

Yeah, I think this came up before

view this post on Zulip Brendan Hansknecht (Aug 31 2024 at 18:53):

Specifically writing a rust platform using lunatic to run roc on the beam

view this post on Zulip Brendan Hansknecht (Aug 31 2024 at 18:53):

Sounds totally doable and like a very cool platform

view this post on Zulip Brendan Hansknecht (Aug 31 2024 at 18:54):

I do think it would be hard to figure out the exact score of supported effects and API, but should be completely manageable

view this post on Zulip Brendan Hansknecht (Aug 31 2024 at 18:54):

I think it's a really cool idea. That said, I would expect it to be a lot of work to get running nicely

view this post on Zulip Brendan Hansknecht (Aug 31 2024 at 18:55):

Like with a decent API and such

view this post on Zulip Egemen Göl (Aug 31 2024 at 21:29):

Hey @Brendan Hansknecht, not just taking inspiration from but using lunatic to support this sounds like a really cool idea, the project seems like it is not being maintained unfortunately :/

Yeah selecting a subset of the beam to support would be a long challenge where a lot of trial and error, also feedback from many people is needed.

Other than the API design, what parts do you think would most problematic?
Also, do you think the language supports this as of today?
Lastly, would you agree that supervisors would fill a less important role since Roc does explicit and forced error handling?

Thanks for the response :)

view this post on Zulip Egemen Göl (Aug 31 2024 at 21:30):

the message where lunatic is mentioned for reference

view this post on Zulip Brendan Hansknecht (Aug 31 2024 at 21:57):

I think today it would be a hassle to set up the platform. Generally speaking, rust and zig are the easiest languages for platforms today, but it requires a lot of knowledge and/or trial and error. On top of that, unless you make sure to always copy data set between threads, you would hit issues with the refcounting model (currently only single threaded).

So I think it should be technically doable today, but only if someone is super motived.

view this post on Zulip Brendan Hansknecht (Aug 31 2024 at 21:58):

I think supervisors would still be useful. Sometimes the best action is to just give up due to the state you have reached

view this post on Zulip Brendan Hansknecht (Aug 31 2024 at 21:58):

Supervisors enable just crashing when it is most reasonable to do so

view this post on Zulip Egemen Göl (Aug 31 2024 at 22:01):

Sounds reasonable, thanks a lot :)

view this post on Zulip Luke Boswell (Aug 31 2024 at 22:14):

@Brendan Hansknecht when would it be a better time to do this?

Like after passed in allocators and effect interpreters? Is that basically the minimum you would want before experimenting with this?

view this post on Zulip Brendan Hansknecht (Aug 31 2024 at 22:15):

I would say passed in allocators probably aren't too important to this. I think it will be:

  1. Effect interpreter
  2. Better glue gen (really just a convenience and not technically required)
  3. A story around multithreaded refcounting

Last updated: Jun 16 2026 at 16:19 UTC