[Issue 3572] New: declaring pure function with void return type should be compile time error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 4 02:37:33 PST 2009


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

           Summary: declaring pure function with void return type should
                    be compile time error
           Product: D
           Version: 2.036
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: michal.minich at gmail.com


--- Comment #0 from Michal Minich <michal.minich at gmail.com> 2009-12-04 02:37:33 PST ---
In D specification is written: "Pure functions are functions that produce the
same result for the same arguments. To that end, a pure function has parameters
that are all immutable or are implicitly convertible to immutable

void function cannot produce any result, thus they are meaningless as pure
functions. Also when all parameters are implicitly immutable, there is no
possibility to modify "out" parameters. So the only way for function to produce
result, is by returning it (and void has no value).

-- 
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