[Issue 11048] Default arguments not taken into account when being called by pure functions
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Sep 16 09:35:23 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11048
--- Comment #2 from Jonathan M Davis <jmdavisProg at gmx.com> 2013-09-16 09:35:22 PDT ---
The default argument is only a problem if the pure function is called from a
pure function. It's perfectly fine if it's called from an impure one. The
problem is not that the default argument references a global but that the
caller does not detect that the default argument of the function it's calling
is a global. So, the caller does not detect that the call violates purity.
The simplest solution is probably to ban the declaration, because then the
caller doesn't have to worry about whether the pure function that it's calling
has any default arguments which would violate the purity of the caller, but
ideally, it's just the call which would be illegal, because the default
argument is just fine so long as the caller isn't pure.
--
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