• zmrl@lemmy.zip
    link
    fedilink
    arrow-up
    3
    ·
    4 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.