Hacker News new | ask | show | jobs
by sischoel 1466 days ago
Isn't that the case for most programming languages? The only exceptions I can think of are C++ and Rust.
2 comments

It's not like this in the functional languages I'm familiar with, F# and Elm
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.

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