News for hackers. Stuff that matters.
Re:Alan Kay on the Meaning of “Object-Oriented Programming” ... by jakobegger on Monday March 18, 2019 @03:55AM (#19419350)
Read-only properties would be implemented as methods that return the value of an internal variable. There should be no way to directly access the internal state of an object, even if it is read-only -- because that would prevent you from changing internal details (eg. do you store the property in a float or a double?), breaking the "encapsulation".
Re:Alan Kay on the Meaning of “Object-Oriented Programming” ... by edwinyzh on Monday March 18, 2019 @04:44AM (#19419501)
Sure, if not implemented as methods that return the value of an internal variable, how can one achieve the "readonly" goal?