Questions tagged [immutable]

For questions about designing languages where data values are immutable and cannot be changed, or implementation aspects specifically related to immutability

Filter by
Sorted by
Tagged with
1 vote
3 answers
274 views

Is there any way a Java-like language could implement immutable primitive arrays without incurring performance penalties?

I asked: What prevents Java from having immutable primitive arrays? a while back and got an answer: Because immutable primitive arrays would typically require checking some immutable flag every time a ...
user16217248's user avatar
  • 7,285
20 votes
6 answers
7k views

Why do some languages have both immutable "variables" and constants?

Some programming languages (Rust is one I can think of off the top of my head) provides mechanisms to have immutable variables but they also have constants. Isn't an immutable variable just a constant?...
QAH's user avatar
  • 311
13 votes
5 answers
447 views

What are the advantages and disadvantages of immutable languages?

This means variables can't be overwritten, arrays can't be modified, and nothing can be modified "in-place" - a new variable has to be created. Or if you need to modify it with a loop, then ...
naffetS's user avatar
  • 989
8 votes
3 answers
289 views

What are the downsides of making all strings immutable to improve security and concurrency?

Many programming languages (such as Java) make strings immutable to mitigate many potential serious security threats. Are there any major downsides or issues with a language having all strings ...
James Risner's user avatar