Skip to main content

Questions tagged [mutability]

11 votes
7 answers
2k views

Expressing immutable, cyclic data structures

Many commonly used programming languages offer built-in mutable container types, or other mutable types that embed references to other objects, and make it trivial to build structures that contain a ...
Karl Knechtel's user avatar
9 votes
6 answers
4k views

Would it be safe to introduce the "freeze" statement?

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
6 votes
2 answers
416 views

How useful is the traditional const in addition to constexpr and rvalue references?

In C++, there are two newly created features related to const: constexpr and rvalue references. (IMHO rvalue reference is not ...
user23013's user avatar
  • 3,314
15 votes
7 answers
3k views

What approaches are there to prevent modifying a collection while iterating over it?

A frequent source of bugs in some languages, is to modify a mutable collection while iterating over it. Appending to a list while iterating over it can cause an infinite loop, while removing from it ...
kaya3's user avatar
  • 22.4k
10 votes
2 answers
418 views

How do you design mutable lists?

Background I have a problem designing a list structure for my language. My language use explicitly mutability, that is, all mutability must be manually marked. But when I marked the mutability of ...
Aster's user avatar
  • 3,458