Hi Andrea,

> -----Ursprüngliche Nachricht-----
> Von: Andrea Faulds [mailto:a...@ajf.me]
> Gesendet: Samstag, 14. Februar 2015 04:18
> An: PHP Internals
> Betreff: [PHP-DEV] [RFC] Void Return Type
> 
> Hi everyone,
> 
> I’ve written a small RFC and patch to add a “void” return type:
> 
> https://wiki.php.net/rfc/void_return_type
> 
> Please have a read over it. I think this would be a simple, yet useful 
> addition.
> 
> Thanks!
> --
> Andrea Faulds
> http://ajf.me/
> 
> 
> 
> 
> 
> --
> PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: 
> http://www.php.net/unsub.php

I think a void type for PHP would make sense but only if the return value of 
such a function cannot be used. 
Otherwise it is another reason for people to laugh at PHP and justifiably so, 
telling that a function does not return anything but return null is very 
inconsistent. 

I suggest to use one of the following behaviours:
1. declaring a function void does not return anything (hence is like echo to a 
certain agree)
2. declaring a function void does return a thing of type void (that would be 
similar to Unit in scala)
3. instead of void a function can be declared to be of type null -> almost the 
same behaviour as your RFC but without the inconsistency

Cheers,
Robert


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

Reply via email to