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

Adam D Ruppe destructionator at gmail.com
Wed Oct 19 18:45:40 UTC 2022


On Wednesday, 19 October 2022 at 18:25:54 UTC, Paul Backus wrote:
> because it would introduce implicit coupling between modules 
> where no coupling (explicit or implicit) previously existed.

How is this any different than inheritance of attributes like 
@safe, which exists now?

(i would argue the difference is that applies to the parameter 
and this applies to the return value, and you can normally 
strengthen params and weaken return contracts so it is kinda 
backward. but that's separate from the coupling thing... kinda, i 
guess the other difference is safe and friends are of most 
restriction to the method implementor, so if it is inherited the 
author of the class just deals with it where mustUse would be of 
most restriction to the method caller. but i gotta run to a 
meeting and haven't thought it all through)


More information about the Digitalmars-d mailing list