Skip to main content

Questions tagged [immutable]

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

4 votes
2 answers
448 views

I'm learning about how modern compilers like Roslyn handle symbol tables and type information. From what I understand, Roslyn uses immutable data structures to represent symbols, which helps ensure ...
Rui Gonçalves's user avatar
5 votes
1 answer
1k views

I have a question about a C# language design. Let's have a following code: ...
TN.'s user avatar
  • 159
9 votes
6 answers
4k views

Would it be safe to introduce the freeze statement for freezing a mutable object into an immutable object? Such statement would mix well into dynamically-typed ...
Dannyu NDos's user avatar
  • 1,485
12 votes
0 answers
325 views

Consider for a motivating example a copy-on-write array, which implements a persistent (i.e. immutable) array data type. As an optimisation at runtime, a reference counter can be used to avoid the ...
kaya3's user avatar
  • 22.4k
2 votes
5 answers
1k views

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 ...
CPlus's user avatar
  • 10.5k
24 votes
7 answers
10k views

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
  • 351
14 votes
5 answers
1k views

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
  • 1,077
11 votes
5 answers
846 views

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