top | item 31736972

(no title)

sischoel | 3 years ago

Isn't that the case for most programming languages? The only exceptions I can think of are C++ and Rust.

discuss

order

arrow7000|3 years ago

It's not like this in the functional languages I'm familiar with, F# and Elm

kaba0|3 years ago

It is not like this in Java either if the components are all immutable as well.

It will be shallowly immutable, but applying it recursively will make it totally immutable. The reason I say that is that in practice it is not that different than FP languages, they just differ in the ratio of FP data structures.

Sankozi|3 years ago

const in C++ is more like Readonly from TypeScript - you cannot modify state of an object, but it still might be possible through other reference/pointer - you have to check source of that value to be sure