On 04/09/2013 03:18 PM, Artur Skawina wrote:
On 04/09/13 13:47, 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.

    struct S;
    int f(S* p) pure;
    S* n();

    int g = 0;

    int main() {
       S* s = n();
       f(s);
       return g;
    }

Is main() guaranteed to return '0'?

artur


No. What is the point?

Reply via email to