top | item 35622622

Firefly – A new compiler and runtime for BEAM languages

245 points| mmcclure | 2 years ago |github.com

50 comments

order
[+] bcardarella|2 years ago|reply
This is a project formerly known as Lumen, which myself and the other core devs presented on at ElixirConf a few years ago: https://www.youtube.com/watch?v=uMgTIlgYB-U

A lot has changed since then.

The name change came about because we found too many projects named "Lumen" also were launched around the same time or shortly thereafter.

Originally I envisioned a path towards creating a new WASM framework to build web applications using Elixir. Since then LiveView has come out and has made this less of a concern for us. While WASM compilation will be possible and we hope to backfill the runtime needs for web development the real focus and interest in this project for me is...

WASI compilation. With Firefly we will be able build self-contained binaries that will have all (many) of the benefits building applications with the BEAM and distributed systems. If WASI can run on something you should be able to compile your Elixir applications with Firefly and target your desired chipset.

We recently reached a milestone that we are hoping to release a blog post about it in the near future.

[+] xcdzvyn|2 years ago|reply
This is pretty awesome. There's bound to be some fun stories about BEAM's internals, given its age.

Have you considered Cranelift as an alternative backend like rustc is doing?

[+] katspaugh|2 years ago|reply
For those who don't know (I didn't) – BEAM is the Erlang virtual machine.

It supports many programming languages.

This new compiler/runtime targets WebAssembly.

[+] chrsig|2 years ago|reply
i'm aware of erlang and elixer -- what other languages run on BEAM?
[+] rkangel|2 years ago|reply
Forget WASI, I'm interested in this project as a way to efficiently run Elixir on microcontrollers. It's a great model for embedded programming (not surprising given that was what it was designed).
[+] rektide|2 years ago|reply
Apologies, what is the sell here? Lots of usage instructions & details but why use this vs Beam actual?
[+] manveru|2 years ago|reply
See the about section: https://github.com/GetFirefly/firefly#about-firefly

> The primary motivator for Firefly's development was the ability to compile Elixir applications that could target WebAssembly, enabling use of Elixir as a language for frontend development. It is also possible to use Firefly to target other platforms as well, by producing self-contained executables on platforms such as x86.

[+] zacksiri|2 years ago|reply
I may be wrong but, “designed for WebAssembly” might be the key selling point here.

I imagine we would be able to write elixir on the frontend with this.

[+] greybox|2 years ago|reply
While I appreciate this is cool project, and I enjoy writing Erlang & Elixir. What benefit is there to being able to run BEAM/OTP in the browser?
[+] jake_morrison|2 years ago|reply
I have been thinking about using the Erlang concurrency and messaging model for brower-based applications.

UI components operate in separate threads and communicate with the back end by sending and receiving async messages.

Back-end components communicate with servers using async messages, then publish results to front-end components.

This is similar to what Joe Armstrong was working on for X-Windows GUIs: https://erlang.org/workshop/2004/ex11.pdf