DIP 1038--"@mustUse" (formerly "@noDiscard")--Accepted

Paolo Invernizzi paolo.invernizzi at gmail.com
Sun Feb 6 15:13:17 UTC 2022


On Sunday, 6 February 2022 at 14:56:42 UTC, Paul Backus wrote:
> On Sunday, 6 February 2022 at 14:32:31 UTC, Paolo Invernizzi 
> wrote:
>> While I like a lot and welcome the addition of this attribute 
>> (so thank you!), I humbly  ask to reconsider using   the full 
>> lowercase alternative instead of camel case.
>>
>> Let's conform with the other built-in attributes listed into 
>> the specs of the language, avoiding what would be another 
>> special case to remember.
>
> There is precedent for compiler-recognized UDAs using camelCase 
> in core.attribute.gnuAbiTag [1], as well as the various 
> LDC-specific attributes [2]. So no matter what I choose here, 
> it will be inconsistent with something.
>
> If you strongly prefer the lower-case version, you can always 
> rename it in your own code:
>
>     import core.attribute: mustuse = mustUse;
>
>     @mustuse struct MyStruct
>     {
>         // ...
>     }
>
> [1]: https://druntime.dpldocs.info/core.attribute.gnuAbiTag.html
> [2]: 
> https://wiki.dlang.org/LDC-specific_language_changes#Attributes

That's fine, I will not insist more, hoping not to see in the 
future it extended as a function attribute ... you know ...

int foo() @nogc @safe @mustUse etc etc ...




More information about the Digitalmars-d-announce mailing list