Is defining get/set methods for every field overkill?


Sat Nov 19 09:51:09 UTC 2022


On Saturday, 19 November 2022 at 09:26:49 UTC, Andrey Zherikov 
wrote:
> On Saturday, 19 November 2022 at 09:12:26 UTC, thebluepandabear 
> wrote:
>> That's the point many people have given here which is not 
>> convincing him, even though it is quite great.
>>
>> I think we all know the answer here 😂
>
> IMHO you are both right :)
> You are speaking about API compatibility, `[]() {}()` speaks 
> about ABI compatibility. The latter makes sense in long-running 
> production software. So we know that there are no issues in API 
> compatibility but we don't know anything about ABI.

no. in C# it breaks ABI. that is why its not acceptable in my 
team.

I expect it would also break ABI in D.

so again, getters/setters will almost certainly have value, even 
if you initially see no value in the few extra keystrokes needed 
to implement them.

the alternative case being presented is to just make class member 
variables public so clients can set/get them directly  .... 
well... good luck with that.

that's the end of my input on this thread.


More information about the Digitalmars-d-learn mailing list