4 ms·
> All languages I know (e.g. Haskell) make concessions to pragmatism. For example, even pure function can somehow create debug output. Every memory allocation d
by jahewson 12y ago
> All languages I know (e.g. Haskell) make concessions to pragmatism. For example, even pure function can somehow create debug output. Every memory allocation does mutate global state.
This still satisfies the definition of a pure function because debug output via trace is not a "semantically observable" side-effect. I think that D would be better off inventing some new terminology instead of misusing existing formalisms: a function which modifies its own arguments isn't even close to being pure.
- WalterBright 12y agoA "strongly pure" function in D is a traditionally pure function, and can be detected by the parameters having const types. const types in D are transitive, meaning that any data reachable through those types is also const. I.e. "turtles all the way down."