[Issue 2832] pure function too pure

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 3 02:17:25 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2832


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug at yahoo.com.au




--- Comment #1 from Don <clugdbug at yahoo.com.au>  2009-07-03 02:17:24 PDT ---
Comment: Allowing this would mean that nested pure functions would no longer be
able to use the parameters from the enclosing function.

pure int fun(int d, int divisor)
{
   int gun() pure { return d+1; } // would be illegal, since 'fun' could modify
d.
    return gun() + d / divisor;
}

Which in turn would mean that nested pure functions would become quite useless.
So there's a price to pay.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list