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

forkit forkit at gmail.com
Tue Feb 8 23:31:37 UTC 2022


On Tuesday, 8 February 2022 at 21:28:06 UTC, claptrap wrote:
>
> Probably @noignore would be a better name. You're not really 
> trying to dictate what people do with the result, just that 
> they dont ignore it.

I'd like to see an option to annotate such an attribute. 
Something like this:

@mustuse("or else this could occur")

Then the compiler could return that message, rather than some 
generic message that provides no real insight into why that 
attribute was used in the first place.

Similar to C++20's: [[nodiscard("check if not null")]])



More information about the Digitalmars-d-announce mailing list