|
|
|
|
|
by awild
1492 days ago
|
|
It's usually on a syntactical level, to disable reassigning a value. For objects this means the reference is still mutable, value types are locked. Js has const, C has const, Java final. Imho it'd be awesome if mutability were not the default and we would have to mark mutability, but until then any variable that doesn't need it, is final. Which also helps skimming code |
|
C# has readonly and const
>Imho it'd be awesome if mutability were not the default
If they decided one day that - "let's make immutable by default", then it'd be performance hit - wouldn't it?