Hi Tim,

Thank you for your reply and for the clarification.
As one of the RFC authors, your insight is very helpful.

I now have a much clearer understanding of the RFC's intent. Your
point that #[NoDiscard] is not meant for every pure function, but
rather for those where ignoring the return value leads to dangerous,
hard-to-detect bugs, makes perfect sense. I agree that focusing the
runtime check on high-risk functions, while leaving most pure
functions to static analysis, is a reasonable approach.

Based on that criterion, I understand that very few built-in functions
should be marked with #[NoDiscard].

To give some context, my initial proposal was motivated by the ongoing
confusion around the semantics of the #[Pure] attribute in the
JetBrains stubs for static analysis. I had hoped that marking more
built-in functions with #[NoDiscard] could help clarify the situation,
but I now see that this is not the appropriate goal for this
attribute.
https://github.com/JetBrains/phpstorm-stubs/pull/1730

It seems a different approach is needed to solve that particular
problem for static analyzers.

Thanks again for your time and the explanation.

Best regards,
Kenta

-- 
ヾ(〃><)ノ゙☆ Kenta Usami (宇佐美健太)
github.com/zonuexe ; https://tadsan.github.io/

Reply via email to