It says in the article that everything is immutable, which I found intriguing, but then I see this in the example at mint-lang
fun increment { next { counter = counter + 1 } }
Something doesn't add up.
fun increment { next { counter = counter + 1 } }
Something doesn't add up.
The `=` is rebinding, what that mean is the original value doesn't change. If you pass that counter variable somewhere, it has its original value. the `count = counter + 1` here mean that a new memory block is allocated, get a value, and the `counter` in this scope is point to it. The old value in the original memory block won't change.
At least, that's the case of Erlang/Elixir.
Question: When is it safe to throw the old value away?