(no title)
robot_no_421 | 1 year ago
If you're writing the code then you can do whatever you want with it. But if I'm writing the code you're using, I want the power to express "the end user cannot use this private field".
You trying to access the private fields in the library I or someone else wrote would be like trying to change a book someone wrote or a painting someone made. It's not the computer restricting you, it's the author of the code.
EDIT: This response was not my finest take.
alkonaut|1 year ago
Quekid5|1 year ago
> And obviously with or without reflection anyone can already modify the private field.
This bit, I don't understand. Wouldn't that require unsafe?
EDIT: Just to say: Abstract data types usually require upholding some invariants which all the operations on those data types must uphold at entry/exit. If anyone can do whatever, then what's left othen than just a bag of bytes?
cryptonector|1 year ago