Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82717 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19952 invoked from network); 15 Feb 2015 10:28:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Feb 2015 10:28:50 -0000 Authentication-Results: pb1.pair.com smtp.mail=francois@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=francois@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 212.27.42.2 as permitted sender) X-PHP-List-Original-Sender: francois@php.net X-Host-Fingerprint: 212.27.42.2 smtp2-g21.free.fr Received: from [212.27.42.2] ([212.27.42.2:31600] helo=smtp2-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F1/51-06835-0E470E45 for ; Sun, 15 Feb 2015 05:28:49 -0500 Received: from moorea (unknown [82.240.16.115]) by smtp2-g21.free.fr (Postfix) with ESMTP id 0BF5A4B028B; Sun, 15 Feb 2015 11:28:34 +0100 (CET) Reply-To: To: "'Andrea Faulds'" , "'Xinchen Hui'" Cc: "'PHP Internals'" References: <680FB44D-B42D-4898-A28B-FA1C6E4D4D1A@ajf.me> <58F62ED2-562E-4851-B2FB-2D973732D9DA@ajf.me> In-Reply-To: <58F62ED2-562E-4851-B2FB-2D973732D9DA@ajf.me> Date: Sun, 15 Feb 2015 11:28:44 +0100 Message-ID: <003301d0490a$2d6070a0$882151e0$@php.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQJarA5HcqMrZRaN+23HbEjTjl9TGQJO6ZrBAtDhoh6bs7drgA== Content-Language: fr X-Antivirus: avast! (VPS 150215-0, 15/02/2015), Outbound message X-Antivirus-Status: Clean Subject: RE: [PHP-DEV] [RFC] Void Return Type From: francois@php.net (=?iso-8859-1?Q?Fran=E7ois_Laupretre?=) Hi, > De=A0: Andrea Faulds [mailto:ajf@ajf.me] > > following codes still works: > > > > $b =3D 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" >=20 > 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=E7ois