Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

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.

I was looking at this 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.

I was looking at this 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.

added 12 characters in body
Source Link
Tulains Córdova
  • 39.5k
  • 13
  • 99
  • 155

I was looking at this thread on SOStack 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.

I was looking at this thread on SO 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.

I was looking at this 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.

added 312 characters in body
Source Link
Aaron Anodide
  • 5.7k
  • 6
  • 30
  • 37

I was looking at this thread on SO 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.

I was looking at this thread on SO 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?

I was looking at this thread on SO 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.

Source Link
Aaron Anodide
  • 5.7k
  • 6
  • 30
  • 37
Loading