[Idea] Support BEAM target
clsource opened this issue · comments
I am just posting this out of curiosity, because the answer is probably no. But i just want to know the technical or personal reason against this (or maybe this is possible?).
The idea is having multiple targets such as Gleam that supports Beam and JS targets.
Maybe Onyx can support Wasm and Beam so it can benefit from the Erlang ecosystem.
Maybe using https://github.com/tessi/wasmex or something like that?.
Thanks again 💯
That is a great question! The main problem with bringing Onyx to the BEAM is that the semantics of Onyx do not match what the BEAM provides. The BEAM does not have manual memory management, pointers, or even modifiable variables afaik. It offers a very different programming model than Onyx, so it would be fundamentally incompatible sadly. It works for Gleam because Gleam was designed for working with the BEAM, and the language semantics match the BEAM's.
You can use wasmex
or similar libraries to embed an Onyx program into the BEAM and run it as a BEAM process. But outputting Erlang/BEAM bytecode would not be possible from Onyx.