It's not mutated or changed it points to a totally different memory location. It's called immutable data not immutable identifiers. Immutable data is what eliminates a large number of potential bugs. Having a ton of intermediate variable names
could actually be a source of bugs plus you have to care if someone reuses the name above the point in code you used it. By allowing rebinding you only care about the code below the place your introduced a variable.
> It's called immutable data not immutable identifiers.
immutable/mutable data and immutable/mutable identifiers are two different things. One is not called the other, they are separate things really.
> It's not mutated or changed it points to a totally different memory location
So you said it yourself. It points to a different memory location. So how is x not mutated then? "Mutated" is a synonym for "change", or so I thought apparently.
I don't see how one can look at a variable being reassigned and say "nope, variable didn't change", where it clearly has a new value in the line below.
> Immutable data is what eliminates a large number of potential bugs.
Agreed. Was using Erlang for many years and tried Haskell before. Immutable data is pretty nice most of the time.
> care if someone reuses the name above the point in code you used it.
Wait, is it the opposite of what you were trying to say? Wouldn't you want to care if you are now randomly re-using or changing variables someone else assigned. I thought immutability was a good thing.
> By allowing rebinding you only care about the code below the place your introduced a variable.
Unfortunately in my code base, the code above the place where variables are introduced is just as mission critical as the code after the place. Maybe I am using a strange coding style or paradigm ;-)
This summarizes my thoughts on "compromise" exactly. It may be a good thing to some people but it was still a compromise to change it for potential benefit in exchange for some potential loss of strict identifier immutability.
I prefer the way Erlang does it. But I get why Elixir did what they did as well.