Re: Command–query separation principle [re: @mustuse as a function attribute]

rikki cattermole rikki at cattermole.co.nz
Wed Oct 19 16:47:45 UTC 2022


On 20/10/2022 5:42 AM, mw wrote:
> On Wednesday, 19 October 2022 at 16:37:51 UTC, rikki cattermole wrote:
>> On 20/10/2022 5:31 AM, mw wrote:
>>> if a method is marked as @mustuse anywhere in the inheritance tree, 
>>> that method in all the class levels in the whole inheritance tree 
>>> became @mustuse!
>>
>> Unfortunately people don't compile their program all at once.
> 
> No, that's a limitation of current D compiler, or the build system dub.

Or Meson
Or CMake
Or make...
Or cli script

> Yes, for this logic to work, every compilation need to do global system 
> analysis (that is what Eiffel compiler does).

But not for native compilers. They work in partial builds, this is core 
to how they work.

> Now the compiler writer have to work harder to implement this logic. Do 
> not compromise!

No amount of work is going to change the fact that the compiler may not 
be aware that code exists.

rt package one example.

Shared libraries another.



More information about the Digitalmars-d mailing list