Skip to content

Comment on Elixir v0.13.0 released, hex.pm and ElixirConf announcedparent

Comments

The variables are NOT immutable. The bindings ARE mutable.

a = [1,2,3,4]

x = a

x = [1,2,3,4,5]

a == [1,2,3,4] => true

x == [1,2,3,4,5] => true

This is empirically NOT the same as ruby or even mutability.

This is a HUGE misunderstanding of Elixir. Once something is created you cannot modify it, PERIOD, you can rebind variables within the same scope. You cannot change the values.

Same thing is possible in clojure, and nobody questions that its immutable.

EDIT: And to be extra clear this is only within the same function. Not possible across functions, modules or processes.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.