On Friday, December 23, 2016 07:29:49 Stefan Koch via Digitalmars-d wrote: > On Friday, 23 December 2016 at 06:53:25 UTC, Observer wrote: > [ ... ] > > A pure function MUST NOT mutate any state except what is > reachable through it's arguments. > This includes ANY operating system state.
That's not quite true. For instance, the spec specifically permits pure functions to read and write the floating point exception flags. Also, functions like malloc have been marked with pure, and that technically involves mucking with the OS state, albeit in a very specific and limited way. So, there _are_ a few instances where we allow it. That being said, it's certainly true that _most_ things that would involve the OS state are forbidden from being messed with in pure functions unless the resource in question is accessed via a function parameter. And any exceptions to that rule have to be for a very good reason. - Jonathan M Davis
