Skip to content

Instantly share code, notes, and snippets.

@krisajenkins
Created November 25, 2013 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krisajenkins/7640726 to your computer and use it in GitHub Desktop.
Save krisajenkins/7640726 to your computer and use it in GitHub Desktop.
Scala, we need to talk about what 'immutable' means.
class Thing { var x = 5 }
val things = scala.collection.immutable.List(new Thing)
println(things.head.x) // Prints 5
things.head.x = 10 // WAT?
println(things.head.x) // Prints 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment