O'Reilly logo

Programming Elixir by Dave Thomas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

You Already Have (Some) Immutable Data

Forget about Elixir for a moment. Think about your current programming language of choice. Let’s imagine you’d written this:

 
count = 99
 
do_something_with(count)
 
print(count)

You’d expect it to output 99. In fact, you’d be very surprised if it didn’t. At your very core, you believe that 99 will always have the value 99.

Now, you could obviously bind a new value to your variable, but that doesn’t change the fact that the value 99 is still 99.

Imagine programming in a world where you couldn’t rely on that—where some other code, possibly running in parallel with your own, could change the value of 99. In that world, the call to do_something_with might kick off code that runs in the background, passing it ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required