Open JohanEngelen opened 7 years ago
speculatable
would be too much on a pure
function: pure
in D does not mean calls can be introduced that would otherwise not happen. E.g. calling foo(0)
for code fragmentif (x != 0) foo(x)
.
What we can do is apply readnone
or readonly
to pure
functions that don't take pointer arguments (or only immutable pointers?).
https://d.godbolt.org/z/i2Dpxw
We also have lovely stuff like void* pureMalloc()(size_t size) @trusted pure @nogc nothrow
(core.memory
)...
pure
!= PUREstrong
anyway.
See https://reviews.llvm.org/rL301680
Would this attribute be helpful for
pure
functions? Or does it imply too much?