Interoperability

All compile to BEAM bytecode and call each other freely.

42.1 The BEAM language family

Ruby-like syntax, macros, Mix/Hex tooling; Phoenix framework statically typed, ML-style; compiles to Erlang or JavaScript LFE (Lisp Flavoured Erlang) Lisp syntax, by Robert Virding

Efene, Alpaca, Caramel, Purerl smaller/experimental languages

All compile to BEAM bytecode and call each other freely.

42.2 Calling Elixir from Erlang

Use Elixir Hex packages in rebar3 with the rebar_mix plugin.

%% Elixir modules are atoms prefixed with 'Elixir.'
'Elixir.String':upcase(<<"hello">>),
'Elixir.Enum':map([1, 2, 3], fun(X) -> X * 2 end).

42.3 Calling Erlang from Elixir & Gleam

:lists.reverse([1, 2, 3])
:crypto.hash(:sha256, "data")
@external(erlang, "lists", "reverse")
pub fn reverse(list: List(a)) -> List(a)

42.4 Other languages

Ports (any language), NIFs (C/C++/Rust/Zig), C nodes, jinterface (Java).

Pyrlang, erlport (Python/Ruby integration).

Serialization across systems: Erlang External Term Format (BERT), JSON, Protobuf (gpb), MessagePack.

42.5 Hex package manager

Erlang, Elixir, and Gleam share hex.pm:

rebar3 hex user register      # or auth
rebar3 hex build
rebar3 hex publish