On Friday, 14 October 2022 at 22:17:52 UTC, H. S. Teoh wrote:

Given that this particular trap crops up regularly, perhaps some sort of warning ought to be added. Once the @nodiscard DIP is accepted & implemented this should be easy to do.


Seems like you're behind the times! The DIP was accepted and implemented with some changes:

https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1038.md#final-review

The summary in full:

---
The language maintainers accepted this DIP with a request for changes:

* rename `@noDiscard`, as they want to avoid adding additional negative attributes to the language. * address issues that arise from the feature's interaction with inheritance when applied to classes. * develop rules for handling covariance and contravariance when applied to functions.

The DIP author addressed these requests by renaming the attribute to @mustuse and allowing it only on structs and unions. His rationale for the latter is described in the section, Design Goals and Possible Alternatives.

The maintainers approved the author's changes and accepted the revised version of the DIP.
---

Reply via email to