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

claptrap clap at trap.com
Fri Feb 5 08:33:21 UTC 2021


On Thursday, 4 February 2021 at 20:15:07 UTC, Q. Schroll wrote:
> On Wednesday, 3 February 2021 at 11:25:29 UTC, Mike Parker
>
> 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.

Are you going to annotate every function that has a return value 
and no side effects? All the math functions, min, max, sqrt? I 
mean is there a difference between "the point of the function is 
its return value", and "if you dont handle the return value bad 
things will happen", and nodisgard is for the latter?

If so, then maybe nodisgard is not the common case.





More information about the Digitalmars-d mailing list