3 ms·
The official documentation[0] is cryptic as well. [0] https://dlang.org/library/core/attribute/mustuse.html https://dlang.org/library/core/attribute/mustuse.ht
by Aisen8010 4y ago
The official documentation[0] is cryptic as well.
[0] https://dlang.org/library/core/attribute/mustuse.html https://dlang.org/library/core/attribute/mustuse.html
- Simon_O_Rourke 4y agoI've always wondered if the Dlang docs are intentionally kept vague and cryptic.
- loeg 4y agoSeems pretty similar to nodiscard in C++17 and previously, GCC attribute warn_unused_result. https://en.cppreference.com/w/cpp/language/attributes/nodiscard https://en.cppreference.com/w/cpp/language/attributes/nodisc... https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attribute...
- mhh__ 4y agoCryptic in what way? I can fix it but the example given is clear, no?
- TingPing 4y agoI think the example is very clear.
- schveiguy 4y agoOof, seems I got the camelcase wrong. It's `@mustuse` Working on updating that. I think the reason the documentation is cryptic is because it's a library-supplied User Data Attribute that is specially recognized by the compiler. The documentation generator is having trouble with it. In code it's pretty simple: https://github.com/dlang/druntime/blob/705fb36e5fc4d930eed85bf0166273c923117108/src/core/attribute.d#L292 https://github.com/dlang/druntime/blob/705fb36e5fc4d930eed85...