Is defining get/set methods for every field overkill?

Dukc ajieskola at gmail.com
Sat Nov 19 12:17:01 UTC 2022


On Saturday, 19 November 2022 at 09:49:18 UTC, thebluepandabear 
wrote:
> 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.
>
> I am too dumb to know what ABI is

ABI is short for application binary interface. Where API means 
how you use another module in source code, ABI means how you 
would use that module in assembly langauge or machine code.

If two versions of a library have the same ABI, the program using 
the library does not have to be recompiled, only relinked to the 
new library (which happens at runtime if it's a dynamically 
linked library).

It tends to be of less importance in D than in C or C++. First, D 
modules usually compile quickly enough that premade binaries 
(which would be hard to keep up to date with the source code 
headers) don't make sense. Second, DUB standardises the build 
process so binaries aren't needed for user convenience either. 
Maybe the most important remaining use case is building a library 
that can be used from other languages.


More information about the Digitalmars-d-learn mailing list