I was looking at this threadthis thread on Stack Overflow and thinking about the functional programming I've been learning, and how immutability is so key there, and it occured to me that maybe some language has gotten the idea to have variables start out "null", then go to a "building" state, and finally become the same as any other immutable when initialization is done.
Is this a valid concept and/or has it been tried or experimented with at the language level?
It might look something like this:
string s new String(); // empty strings start out mutable
for x = 1 to 10
s = s + "z"
s.Freeze() // now it's immutable
It's just a thought.. maybe it's not a good one, but it seems like a hybrid of two things that seem to be opposing one another.