• @Opisek
    link
    13 months ago

    Not quite. Picture an immutable map in your programming language of choice (something like const map). You cannot reassign the map object to a new one, but you totally can change its keys and values.

    • @[email protected]
      link
      fedilink
      33 months ago

      I get what youre saying but this is still only kind of true for languages that only the variable assignment is constant (like javascript) rather than the value itself (like rust). If I create a map in rust, without any modifiers, that map is immutable and can’t be changed (not even the contained values). If I create a map in JavaScript using the const keyword, I have created a constant in that block that cannot be reassigned, but any values within the map are changeable like you mentioned. It means the object itself is mutable, but it belongs to a variable that is not.