Hi!

> What would be the point of *allowing* returning a value? It's clearly

It's an error only because you declared it an error.

> an error. We could let you return anything and then discard it, but
> now you won't spot the error in your code.

Function return values which are going unused all the time. In PHP,
functions are very frequently called for side effects and not return
values. So returning value and discarding it is a common and perfectly
valid scenario. And it also has absolutely nothing to do with void
declaration - void declaration doesn't cause discarding the value and
you can discard the value with or without it.

> It's not merely for the sake of it. It makes function signatures more
> descriptive, and lets you catch bugs in your code.

Only bug it can catch is wrongly declaring the function to be void -
which is introduced by this RFC. For me, it is a clear case of
generating error for the sake of error.

> We already use void in the manual: why not in PHP?

Because the manual is the *documentation*, not code. It explains that
the function does not return anything useful. It's not the same as
creating an error when function returns something useful.
-- 
Stas Malyshev
smalys...@gmail.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to