[erlang-questions] Simple Erlang Recommendation (last returned value)

James Hague james.hague@REDACTED
Mon Jul 28 18:22:28 CEST 2008


On Sat, Jul 26, 2008 at 5:54 PM, Alain O'Dea <alain.odea@REDACTED> wrote:
>
> Erlang should not introduce mutable variables because they make it easy to
> disguise a variety of code smells as clean code.

You say "mutable"; I say "introducing a new symbol into the
environment which has the same name as a previously existing symbol."
The difference is that the second is already 100% possible in Erlang.
You can trivially simulate reusing a symbol name without changing
Erlang semantics AT ALL.  One way is to have a preprocessor make
symbol names distinct.  Another is by passing all live symbols to a
new function as parameters, changing the ones you want (see
http://prog21.dadgum.com/5.html).

True mutability of data structures is something else entirely, and
that's not a road I would ever consider going down.

James



More information about the erlang-questions mailing list