AW: [PHP-DEV] [RFC] Void Return Type

From: Date: Sat, 14 Feb 2015 21:23:49 +0000
Subject: AW: [PHP-DEV] [RFC] Void Return Type
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-82702@lists.php.net to get a copy of this message
Hi Andrea, > -----Ursprüngliche Nachricht----- > Von: Andrea Faulds [mailto:ajf@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

« previous php.internals (#82702) next »