Observational purity
Marco Leise
Marco.Leise at gmx.de
Wed Aug 31 07:55:52 PDT 2011
Am 31.08.2011, 08:12 Uhr, schrieb Don <nospam at nospam.com>:
> I didn't understand this line of the paper. Although what they propose
> clearly works for caching, I don't see how it can possibly apply to the
> log file example.
A log file is appended to and never read from. It is not part of the
program state, like a temporary or cache file would be. Writing the log
does not change an observable state in the program. Compare the file to a
memory location in your program. Usually you don't access arbitrary raw
memory addresses like that private member of an object that caches a
value, but you could. Observational purity only works because we restrict
ourselves to operations that are in the spirit of things like 'private
members' or 'log files'. Admittedly it is possible for a language/compiler
to disallow unsafe pointer operations, but not keep you from reading your
log files back in.
More information about the Digitalmars-d
mailing list