Hey François,

On 14 Feb 2015, at 04:57, François Laupretre <franc...@php.net> wrote:

> That's a nice addition and a beginning to distinguish void from null, as I 
> imagine the function still returns null.
> 
> Now, what about making void a real zval type ? It would open a lot of 
> possibilities. Unlike null, conversions from void would raise an error. It 
> would also be rejected as argument input type but could be used as an output 
> type when arg is passed by ref, it could be the default type for return_value 
> (huge BC break here) and so on...

We could do this, but for the longest time we've made all functions have some 
return value, even ones which don't explicitly return one (they return NULL). I 
think it'd be better not to change this. I expect IDEs and such could earn you 
about it, though.

> There's a need for a real 'no value' type different from null, as null has 
> too many uses. If defined correctly, it can be a powerful addition.

If I was to go back to 1994, I'd add "undefined" to PHP like JS has. Today, 
though, I think that is unrealistic, as much as I wish it wasn't. A void type 
only really makes sense as a pseudo-type for return type checking purposes, IMO.


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

Reply via email to