On 3/31/18 4:01 PM, Simen Kjærås wrote:
On Saturday, 31 March 2018 at 19:18:24 UTC, Shachar Shemesh wrote:struct S { int a;void func(int b) pure { // For some strange reason, this is not considered a pure violation. a+=b; } }It's the exact equivalent of this code: void func(ref S s, int b) pure { S.a += b; }And that code is perfectly pure accordion to D rules - it does not modify any data not reachable through its arguments.
Yah, only strongly pure functions would qualify. Indeed that's easy for the compiler to figure - so I'm thinking pragma(isStronglyPure, expression) would be easy to define.
What would be some good uses of this? Andrei
