Discussion Thread: DIP 1038-- at nodiscard--Final Review

Q. Schroll qs.il.paperinik at gmail.com
Thu Feb 4 20:15:07 UTC 2021


On Wednesday, 3 February 2021 at 11:25:29 UTC, Mike Parker wrote:
> This is the discussion thread for the Final Review of DIP 1038, 
> "@nodiscard":

I wonder how many non-void functions exist whose return values 
are usually ignored. The DIP correctly identifies the results of 
assignments as commonly discarded values. Apart from those, 
printf and readf come to my mind. All in all, I do think those 
functions are rare.
Having an attribute for the common case seems backwards to me. 
More often than not, it will be omitted. It is probably better to 
do it the other way around: Add a @discard (or @maydiscard or 
@discardable) attribute to apply to printf, readf, and friends to 
indicate that discarding their result is an intended form of 
their use.


More information about the Digitalmars-d mailing list