Attributes
Alaric B. Williams
alaric@abwillms.demon.co.uk
Tue, 16 Sep 1997 21:43:05 +0000
> I had thought that pure functions were a fairly well defined concept, so
> that a function is pure if and only if every call of it with identical
> (formal) parameters will produce identical results.
>
> Of course, this probably isn't correct, since this would allow a function
> which only modified global variables (which would then be used by other
> functions). So let's add the requirement.
Ah, well - but a function that "leaves a record" would surely still
be pure, just functions that reference that record would then be
impure, right? There's a shade of purity. A function that marks in a
log every application might be considered pure for reasons of
analysing the code produced by a compiler to see if it memoises
correctly and stuff like that... but if the function is being used
more as a setter - ie, the mutation is part of it's "exported"
semantics - then, indeed, it isn't quite pure any more. The
difference there is hard to define, no? :-)
> -Billy
ABW
--
Alaric B. Williams Internet : alaric@abwillms.demon.co.uk
http://www.abwillms.demon.co.uk/