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

Paul Backus snarwin at gmail.com
Wed Feb 9 16:21:24 UTC 2022


On Wednesday, 9 February 2022 at 14:30:30 UTC, Guillaume Piolat 
wrote:
> On Monday, 7 February 2022 at 19:57:28 UTC, forkit wrote:
>> First, I'm not 'insisting' on anything. I'm just expressing a 
>> view.
>>
>> nodiscard is already used by more programmers that D is likely 
>> to ever adopt.
>>
>> Indeed, it's these programmers that D is trying to adopt.
>>
>> I'm not sure forcing such people to adapt is necessarily the 
>> right approach.
>>
>
> I'll have to side with forkit there.
>
> In audio software (at the very least) you pay very dearly the 
> price of introducing new _words_, because the existing words 
> embodies existing meaning and practice that users have 
> internalized.

In D, there is no existing word for this, so from that 
perspective both "mustuse" and "nodiscard" are equally valid.

In other languages, there are multiple existing words:

- C++17: [[nodiscard]]
- C (gcc/clang): __attribute__((warn_unused_result))
- Rust: #[must_use]

If you are used to C++, then you will find "nodiscard" natural, 
and "mustuse" will require you to learn a new word. If you are 
used to Rust, then you will find "mustuse" natural, and 
"nodiscard" would have required you to learn a new word.

And, of course, if you are used to Python or Javascript or one of 
the many other languages that has no word for this at all, it 
will make little difference to you either way.

C++ is quite popular, but it is not the only popular language, 
and there are many D programmers who have never used C++ at all, 
let alone C++17 or later. Therefore, it is a mistake to assume 
that all or even most D programmers have already internalized 
"nodiscard", or indeed *any* particular word for this concept.


More information about the Digitalmars-d-announce mailing list