Any tips on how to create a BEAM language?

Björn, since there are so many people writing (or wanting to write) languages that run on the BEAM you could probably start a consultancy advising them - given you wrote so much of it :003:

1 Like

(caveat: I’m not a language design expert, and only got about half way through Crafting Interpreters)

iirc, it’s that values on the BEAM are truly immutable (they have to be, otherwise the GC doesn’t work). For straight-up imperative code, that’s not actually a huge problem – you can fake a lot of stuff with Elixir-style rebinding. But when you introduce anonymous functions that in other languages (such as Dart or Rust) would allow mutating the outer context, you simply can’t do that on the BEAM.

There are other places this’ll bite you, which escape me right now.

There are workarounds – you could keep all of your mutable variables in ETS, or in gen_server state, or whatever – I think Luerl does some of this – but it feels like cheating to me.

1 Like