Re: [VOTE] Void Return Type RFC

From: Date: Fri, 30 Oct 2015 08:38:44 +0000
Subject: Re: [VOTE] Void Return Type RFC
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.internals 
Request: Send a blank email to internals+get-89015@lists.php.net to get a copy of this message
Hi, I'm still not sure why we are using void as the return type and not null. Null matches behaviour, void just adds another keyword without value. ~C On 30 October 2015 at 04:33, Rasmus Lerdorf <rasmus@lerdorf.com> wrote: > On 10/29/2015 08:55 PM, Stanislav Malyshev wrote: > > Hi! > > > >> "void" or "null" as return type would give a 100% guarantee that > >> every > possible > >> implementation of a given interface won't return any random value. Then > it would > >> make no difference if the returned value is being used or not, as it > >> would always > >> be null. > >> > >> So, it obviously solves the problem presented. There's not much to > dismiss here. > > > > That's what I am having issue with. I don't see the case where such > > guarantee is useful. If you're not using the return value, why do you > > care if it's always null or sometimes null and sometimes baloney > > sandwich? If you need always null, you have it: null. You don't need to > > use return value of a function for it. > > I agree with you Stas, but I still voted yes on this RFC as I don't see > the harm in having it. It is more of a hint for the compiler/static > analyzers for them to spew warnings/errors than it is a useful feature > at runtime. Enough people consider it a missing check mark on the > feature list for it to be added. > > -Rasmus > >

« previous php.internals (#89015) next »