On Wednesday, 30 January 2013 at 12:11:30 UTC, TommiT wrote:
Because this way we can add to D's documentation: "NOTE: properties are *not* inter-changeable with public member variables", and thus, actively discourage people from writing un-encapsulated interfaces which expose public member variables.

The moral of the story:

We should all stop thinking of properties as data, and start thinking properties as functions that you call with a data-like interface.

The value of properties is in clearer semantics:
Separate accessor and mutator are tied together very loosely, that is, only by the similarity in their naming: getSomething, setSomething.

Whereas property getter and setter have the same name, and thus are semantically un-ambiguously tied together.

Reply via email to