Sorry, I forgot that replacing 'void' with 'null' should support 'return
null;' of course. If we don't really enforce 'void', distinguishing this
from 'return;' is inconsistent, IMO.

> -----Message d'origine-----
> De : François Laupretre [mailto:franc...@php.net]
> Envoyé : dimanche 15 février 2015 11:29
> À : 'Andrea Faulds'; 'Xinchen Hui'
> Cc : 'PHP Internals'
> Objet : RE: [PHP-DEV] [RFC] Void Return Type
> 
> Hi,
> 
> > De : Andrea Faulds [mailto:a...@ajf.me]
> > > following codes  still works:
> > >
> > >   $b = a();
> > >
> > > so, if you want a void return type, and if you want it to be a useful
> feature..
> > >
> > > above expr should be invalid with an error " a() return nothing"
> >
> > I'm not sure about this. PHP has always made functions valid rvalues,
for
> > better or for worse. This RFC could make void functions "truly" void
> 
> What about renaming this hint to 'null', instead of 'void'. I know that it
> supports no explicit return and 'return;' with no value but what it does
is
> more checking that return value is null, than checking return value is
'void',
> whose concept is not defined yet.
> 
> It would remove the ambiguity on the fact that the return value is used or
> not. The only justification is that, in PHP, not returning an explicit
value, or
> using 'return;' returns null, that's history, period.
> 
> I think it would make the concept easier to understand and would reserve
> the ambiguous 'void' keyword for the future, if it finds a utility one
day.
> 
> Cheers
> 
> François



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

Reply via email to