In the following code I instantiate Name once and memory must be allocated to store two strings. I then make a copy of that first object, but only changing one property:
case class Name(first: String, last: String)
val original = Name("Freddie", "Mercury")
val copy = original.copy(first = "Robert")
My question - since last is an immutable val, does Scala point copy.last to the same string in memory as original.last in order to save space?