Re: [VOTE] Void Return Type RFC

From: Date: Thu, 29 Oct 2015 00:44:58 +0000
Subject: Re: [VOTE] Void Return Type RFC
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-88980@lists.php.net to get a copy of this message
> Am 29.10.2015 um 01:08 schrieb Andrea Faulds <ajf@ajf.me>: > > Hi everyone, > > It’s been two weeks, so voting on this RFC can start. The rules are as usual. This is a > language change, so a 2/3 majority is required. > > The vote can be found here: > > https://wiki.php.net/rfc/void_return_type#vote > > Voting starts today (2015-10-28) and will end next Sunday (2015-11-08), 10 days’ time. > > Thanks! > -- > Andrea Faulds > http://ajf.me/ Hey Andrea, In general I like the RFC's idea to have a return type for functions returning nothing in particular/null. I'm just thinking null would be a better choice than void. After all, you're not being able to use void anywhere else except in context of single return value. In every other case like unions or even returning null by reference (yeah, I know, but we should consider that case too.), we'll need null. void doesn't make any sense here. I prefer to not make the mistake of mixing null and void in return types. It'll be just inconsistent. And aside from that, there's always the logic point that a void function should return nothing, not null. So, we'd should enforce it, but we can't really due to dynamic function calls when we want to forward the result etc.. So, we should declare our functions to return null and not void, because that's what we really get. It's maybe a break with most languages, but returning null, is what is most suited to PHPs dynamic nature. We shouldn't fixate on void, just because most languages use it (there are already some exceptions though), but really choose what fits PHP best. Hence -1 on void until we can discuss null too. Thanks, Bob

« previous php.internals (#88980) next »