FeedbackThread: DIP 1038-- at nodiscard--Community Review Round 1

Ben Jones fake at fake.fake
Wed Dec 9 16:53:17 UTC 2020


On Wednesday, 9 December 2020 at 15:29:01 UTC, Paul Backus wrote:
> On Wednesday, 9 December 2020 at 14:30:13 UTC, Andrej Mitrovic 
> wrote:
>>> By contrast, @nodiscard can be used with any function because 
>>> all functions have a return type.
>>
>> Just a small implementation note: I think @nodiscard should 
>> not apply to void functions. In other words, if I have:
>>
>> -----
>> @nodiscard:
>>
>> int foo();
>> void bar();
>> -----

We've seen some annoyance related to attributes that don't have 
an opposite (see DIP 1029).  Does it make sense to have a 
corresponding @discard attribute?  I think it would feel write to 
define functions as @discard, but having the escape hatch might 
be nice.


More information about the Digitalmars-d mailing list