On 04/09/2013 01:47 PM, Simen Kjærås wrote:
On Tue, 09 Apr 2013 13:10:16 +0200, Artur Skawina <[email protected]>
wrote:
A function that both directly depends on global mutable state (and
modifies it) can hardly be called pure. Can you (anybody) give a
D "pure" definition that allows for the program that I've posted
and still makes "pure" useful?
Functions that are pure may only mutate mutable state explicitly passed
to them, or created within.
There. That's basically all there is to D's pure. From this definition
arise some useful properties, e.g. that a function whose parameters are
all immutable or implicitly castable to immutable, is referentially
transparent.
pure notReferentiallyTransparent(){ // forall vacuously true
return new Object();
}