On Wednesday, 21 December 2016 at 02:27:02 UTC, Andrei Alexandrescu wrote:
If it's elidable, it's as good as a bug in the program. Must be either a compile-time error or a special case. -- Andrei

I can't see it ending well to make it this kind of special case. For example, one day someone will take one of these not-really-pure-by-any-definition-but-labelled-pure-for-some-reason-and-treated-as-a-special-case functions and make it return, I don't know, an int, and then be surprised that the compiler now elides the function call. If users rely on this special case behaviour, eventually someone will need a way to make a "pure"-with-side-effects function return values without being treated like a pure function.

On the other hand, making it a compilation error might get in the way of generic programming, so that's worth considering.

Reply via email to