2 ms·
I think the problem there is more one of library design than specifically a mutable object problem. If `a` is mutated by the `.add()` method, then it should pr
by fastball 5y ago
I think the problem there is more one of library design than specifically a mutable object problem.
If `a` is mutated by the `.add()` method, then it should probably return void rather than returning a copy of the object.
Is the immutable DX still better in this specific example? Probably. But the above at least would help developers avoid the major footgun with mutability.