in reply to Re^7: The fallacy of the *requirement* for read-only instance variables.
in thread The fallacy of the *requirement* for read-only instance variables.
And if it is immutable, I simply don't have to care. That's a benefit, because it reduces mental load while programming.
Sorry, but that simply isn't true. There is no reduction in cognitive load in a hybrid environment, because you still have to think about which type you are dealing with every time.
That's not a big issue if you have a clear mental model about what a "value object" and what a mutable object is.
A clear mental model huh.
Perl 5 is a good example: numbers are immutable,
Really?
$i = 1; ++$i; print $i;; 2
Okay. Bye.
|
|---|