Hacker News new | ask | show | jobs
by awild 1482 days ago
> If they decided one day that - "let's make immutable by default", then it'd be performance hit - wouldn't it?

Not really. It's just a syntactic default, reassigning local variables should be discouraged from except for iterators etc. It just fosters bad habits.

For example, A list can still be mutated like usual, the reference however may not change. This usually allows compilers to do optimizations in multithreaded situations. But that's not why I code that way, it reduces the cognitive burden of keeping track which variables are actual moving parts as opposed to context/names etc.

> C# has readonly and const

Haven't written C# in a few years, GP was talking about variables as far as I can tell and their lack of immutability.