Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82681 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6321 invoked from network); 14 Feb 2015 12:26:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Feb 2015 12:26:21 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.208 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.208 imap2-3.ox.privateemail.com Received: from [192.64.116.208] ([192.64.116.208:53826] helo=imap2-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 13/10-03565-AEE3FD45 for ; Sat, 14 Feb 2015 07:26:19 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 5A77E8C007B; Sat, 14 Feb 2015 07:26:15 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap2.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap2.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id a_8Go-eSqk0J; Sat, 14 Feb 2015 07:26:15 -0500 (EST) Received: from [137.50.28.190] (oa-res-28-190.wireless.abdn.ac.uk [137.50.28.190]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 151568C0069; Sat, 14 Feb 2015 07:26:11 -0500 (EST) References: <680FB44D-B42D-4898-A28B-FA1C6E4D4D1A@ajf.me> <012c01d04812$bf8e7560$3eab6020$@php.net> Mime-Version: 1.0 (1.0) In-Reply-To: <012c01d04812$bf8e7560$3eab6020$@php.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-ID: <0E369BA2-363A-4AF5-88F2-3643CCE55E5C@ajf.me> Cc: PHP Internals X-Mailer: iPhone Mail (12B466) Date: Sat, 14 Feb 2015 12:26:08 +0000 To: "" Subject: Re: [PHP-DEV] [RFC] Void Return Type From: ajf@ajf.me (Andrea Faulds) Hey Fran=C3=A7ois, On 14 Feb 2015, at 04:57, Fran=C3=A7ois Laupretre wrote: > That's a nice addition and a beginning to distinguish void from null, as I= imagine the function still returns null. >=20 > Now, what about making void a real zval type ? It would open a lot of poss= ibilities. Unlike null, conversions from void would raise an error. It would= also be rejected as argument input type but could be used as an output type= when arg is passed by ref, it could be the default type for return_value (h= uge BC break here) and so on... We could do this, but for the longest time we've made all functions have som= e return value, even ones which don't explicitly return one (they return NUL= L). I think it'd be better not to change this. I expect IDEs and such could e= arn you about it, though. > There's a need for a real 'no value' type different from null, as null has= too many uses. If defined correctly, it can be a powerful addition. If I was to go back to 1994, I'd add "undefined" to PHP like JS has. Today, t= hough, I think that is unrealistic, as much as I wish it wasn't. A void type= only really makes sense as a pseudo-type for return type checking purposes,= IMO. Thanks.=