As asked
Elixir values are immutable, but you can rebind variables. What does that actually mean at the BEAM level, and how does it affect how data is shared between processes?
Sample answer outline
Variables in Elixir are bindings to values, not containers. Rebinding (x = x + 1) creates a new binding, the old value is unchanged. Data passed between processes is copied (deep copy for heap terms), so there is no shared mutable state by design. Large binaries are an exception: they are reference-counted on a shared binary heap. A strong answer mentions that pattern matching is a destructure + assertion, not assignment.
Expect these follow-ups
- What is the large binary heap in the BEAM and when does copying not occur?
- How does immutability relate to the 'let it crash' philosophy?