To help LDC/GDC

Simen Kjærås simen.kjaras at gmail.com
Tue Apr 9 04:47:53 PDT 2013


On Tue, 09 Apr 2013 13:10:16 +0200, Artur Skawina <art.08.09 at gmail.com>  
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.

-- 
Simen


More information about the Digitalmars-d mailing list