Re:Inheritance Often Doesn't Make Sense
by seanmcdirmid on Saturday March 17, 2018 @10:05AM
(#16606971)
Values should be immutable even in OO languages. A point’s x and y coordinates can’t be mutated because then it would be a different, just like a number’s value can’t be mutated. The question is then is a rectangle a value or an object? I would say no and then stack allocate it like any other value, recomputing it if a rect property ever changed.
The real world has both values and objects, any ideology that doesn’t acknowledge both is just fooling itself.
The real world has both values and objects, any ideology that doesn’t acknowledge both is just fooling itself.