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

mw mingwu at gmail.com
Wed Oct 19 07:41:33 UTC 2022


On Wednesday, 19 October 2022 at 07:28:21 UTC, Mike Parker wrote:
> On Wednesday, 19 October 2022 at 04:52:31 UTC, mw wrote:
>
>> @mustuse as a function attribute was in the original version 
>> of the DIP. It was vetoed by Walter. Thus, only the type 
>> attribute remains in the accepted version.
>>
>
> Please include the entire context that I posted earliar from 
> the summary of the formal assessment here:
>
> https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1038.md#formal-assessment
>
> Walter didn't just willy-nilly "veto" the attribute on 
> functions. He accepted the proposal with three requests for 
> enhancement, one of which I summarized as:
>
>> develop rules for handling covariance and contravariance when 
>> applied to functions.

Covariance and contravariance is a big topic by itself.
But ..., what does it have anything to do here with @mustuse as a 
function attribute?

@mustuse here only enforces there must be a receiver of the 
function call result, and do not throw away the returned result.

I'd really like to see some examples what's this concern is about.


> Paul opted instead to punt on this and restrict the attribute 
> to types, which was a perfectly reasonable thing to do. Note 
> that the DIP was still accepted.
>
> Walter doesn't *not* want the attribute to apply to functions. 
> It's just that he wants it to be more fully specified. He and 
> Paul had a series of emails on this and other aspects of the 
> DIP.
>
> If anyone is willing to take this and flesh it out further so 
> that it meets Walter's criteria for applying to functions, 
> please let me know. It's pretty much guaranteed to be approved.

I wish I have more time, but I just have so many things to do 
these days.



More information about the Digitalmars-d mailing list