|
|
|
|
|
by pcwalton
4426 days ago
|
|
You can use privacy for (1); admittedly it's a little hokey, but I feel it's not worth the added complexity to add field-level immutability directly into the language since you can use other language features to effectively achieve it. `std::cell::Cell` and `std::cell::RefCell` give you (2). |
|
What advantages does (2) provide? Isn't it a potential source of errors?