> D pure functions are significantly different than this definition (as of recent times, when weak-pure was added). > Essentially, a pure function cannot access global variables. However, it can access variables referred to via a member of the object instance. > i.e. this is a valid pure function: class C { int x; pure void foo() { x++; } }
I... did not know that. But even in that case, pure wouldn't make much sense, because doing anything like freeing memory or closing a file handle affects global variables (whether directly in the runtime or indirectly in the OS)... right?