Re: [RFC] Void Return Type

From: Date: Sat, 14 Feb 2015 05:03:44 +0000
Subject: Re: [RFC] Void Return Type
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hey:



On Sat, Feb 14, 2015 at 11:18 AM, Andrea Faulds <[email protected]> wrote:
> 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.
be honest, I think it's only part of the idea is implemented.

which make it useless.

in PHP, even if you don't return anything, NULL is returned implicitly.

even if a function is declared return nothing(void).

like:

   function a() : void {};

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"

so, I am -1 on this in complete RFC

thanks
>
> Thanks!
> --
> Andrea Faulds
> http://ajf.me/
>
>
>
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>



-- 
Xinchen Hui
@Laruence
http://www.laruence.com/


Thread (24 messages)

« previous php.internals (#82670) next »