On 23-05-2012 13:48, Artur Skawina wrote:
On 05/23/12 05:22, Steven Schveighoffer wrote:
it has no parameters and no return, marking it as pure makes it strong pure,
and an optimizing compiler can effectively remove the call completely!
Arguably a pure function not returning a value doesn't make sense... D's
definition
of "pure" makes things a bit more complicated, and the fact that it is so
vaguely
defined doesn't help. Eg what does "a pure function can terminate the program"
mean?
A literal interpretation forbids eliminating any calls, or even moving them in
a way
that could affect control flow (by terminating early/late)...
Anyway, result-less "pure" functions obviously can have side effects, so
removing
calls to them shouldn't be allowed.
On 05/23/12 05:31, Alex Rønne Petersen wrote:
I'm in favor of what you suggested on GitHub: A @weak attribute to enforce weak
purity for functions marked pure.
No. "@weak" should be for defining weak symbols, reusing it for anything else
would
just cause confusion,
artur
I had no idea what weak symbols were until I read your post. Just due to
that fact, I am not convinced that weak symbols are interesting enough
to occupy @weak.
--
Alex Rønne Petersen
[email protected]
http://lycus.org