Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88798 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44746 invoked from network); 14 Oct 2015 22:55:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Oct 2015 22:55:21 -0000 Authentication-Results: pb1.pair.com header.from=korvinszanto@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=korvinszanto@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.49 as permitted sender) X-PHP-List-Original-Sender: korvinszanto@gmail.com X-Host-Fingerprint: 209.85.220.49 mail-pa0-f49.google.com Received: from [209.85.220.49] ([209.85.220.49:33645] helo=mail-pa0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4F/96-33697-85DDE165 for ; Wed, 14 Oct 2015 18:55:20 -0400 Received: by pabrc13 with SMTP id rc13so66805926pab.0 for ; Wed, 14 Oct 2015 15:55:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-type; bh=ZU64PvAhFGV2f/9lD16LHo102c6OuGHOWuXFz/NQbUA=; b=KQTHlrxBMO1x0L49W/uRkiG3/eWlpGRM/TjltV9LjYf/2z6y4qmFu6t+c8crAXBqFN WnkLHnpJ0WGGoLpKdXrEKb3fKWURGVS9rjdcnFdziMIqJFEyjbqwUOCQRS5jU9r+8gtx CIf9+zCPXZYQT3QTGP1xtQdJBk2x8H80eo+zllsCNort7aRV50+WxsF677J6xAv4VM2Z pwyDIncXJxO9gmfRhM0eNIFI4QzXvxoNUT5j0miZOGoYDuKFVtDTL8DUT9Hu30loxVbX +SiFQwXzwM3819SMCqK+00YkbgILkZvemP0nYBhUZ81oxfxh2nsMrHPXk5tT19E1Kp8F TVGg== X-Received: by 10.68.103.194 with SMTP id fy2mr6189361pbb.120.1444863316779; Wed, 14 Oct 2015 15:55:16 -0700 (PDT) MIME-Version: 1.0 References: <0A.C2.33697.6AECE165@pb1.pair.com> <561ED07E.4060809@gmail.com> In-Reply-To: Date: Wed, 14 Oct 2015 22:55:07 +0000 Message-ID: To: Levi Morrison , Stanislav Malyshev Cc: Andrea Faulds , internals Content-Type: multipart/alternative; boundary=047d7b5d63cebeeecf05221874b6 Subject: =?UTF-8?B?UmU6IFtQSFAtREVWXSBbUkZDXSBWb2lkIFJldHVybiBUeXBlICh2MC4yLCByZcO2cGVuaQ==?= =?UTF-8?B?bmcp?= From: korvinszanto@gmail.com (Korvin Szanto) --047d7b5d63cebeeecf05221874b6 Content-Type: text/plain; charset=UTF-8 On Wed, Oct 14, 2015 at 3:47 PM Levi Morrison wrote: > On Wed, Oct 14, 2015 at 4:00 PM, Stanislav Malyshev > wrote: > > Hi! > > > >> I'm reviving my Void Return Type RFC, this time for PHP 7.1: > >> > >> https://wiki.php.net/rfc/void_return_type > >> > >> Please read it and tell me your thoughts! > > > > I still see no point in this, as every PHP function actually returns > > something (at least null). So this type would not actually be right and > > would not reflect what actually is happening. > > I agree that `void` doesn't make sense given that we document that > `return;` will return null[1]. If the union types RFC[2] passes it > makes sense to allow `Foo | null` which allows something of type `Foo` > or `null`. To me it makes sense that if you then remove `Foo` you are > left with `null`, not `void`. My personal recommendation because of > this would be to use `null` for the return type and instead of `void`. > Isn't null supposed to mean the absense of a value and not take the place of a value in PHP though? Didn't we just have a long conversation about this in a thread about PHPSadness? If I capture the result of a "void" method and check if my result variable with isset(), I'll get false. This sounds like it's void of value to me. > Also, I do not think this feature is pointless. For instance, it has > value in interfaces. Declaring that a method does not return a value > means implementors cannot accidentally return something. This is > better than just documenting that it should not be done. > This is what I was thinking too, I'm not sure that there's much value beyond that > [1]: http://php.net/manual/en/function.return.php > [2]: https://wiki.php.net/rfc/union_types > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --047d7b5d63cebeeecf05221874b6--