Future of memory management in D

12345swordy alexanderheistermann at gmail.com
Sat Nov 20 23:34:31 UTC 2021


On Saturday, 20 November 2021 at 16:42:02 UTC, Atila Neves wrote:
> On Friday, 19 November 2021 at 10:21:35 UTC, Max Samukha wrote:
>> On Thursday, 18 November 2021 at 19:32:36 UTC, Atila Neves 
>> wrote:
>>
>>>
>>> Works with `ref prop() { return _fld; }`.
>>
>> The whole point of properties is to hide private state.
>
> I don't agree - I think the point is to treat getters like 
> state.
>
>> Exposing a private member for direct mutation is generally a 
>> bad idea.
>
> I agree wholeheartedly. Getters are a code smell, setters stink.

It is not a code smell if:
You are concern with the private member integrity.
You wanted to call other functions such as log audit every time a 
variable is being written.

- Alex


More information about the Digitalmars-d mailing list