[Issue 3572] 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 12:01:57 PST 2009


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


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-12-04 12:01:56 PST ---
(In reply to comment #0)
> 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).

I think the restriction on 'out' parameters will be removed. I don't think
there's any reason for it.
A void pure function that doesn't have any 'out' parameters does seem to be
pretty useless (you can use it as a metaprogramming test that anything inside
it is pure, but that's about all I can think of).

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