Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110831 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 5357 invoked from network); 3 Jul 2020 10:59:56 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Jul 2020 10:59:56 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D179A180088 for ; Fri, 3 Jul 2020 02:49:35 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 3 Jul 2020 02:49:35 -0700 (PDT) Received: by mail-ej1-f52.google.com with SMTP id y10so33527778eje.1 for ; Fri, 03 Jul 2020 02:49:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DYXidhXetMjXM/69kCk3cxYSpCrg2+4xkE3MVSwGjbM=; b=QyxR1oTEdkYYKCh9i9dsD9a1Hbpu7NJYV9JbrrXSy7Gvsc0MrwHm2LTcHCCXsa6m9n U61V3KZ6wUpe9bb5MQLGfPs+IWF7eaXfRz8/krIPr0D68ejW4iTTl6Jlyeq7LRHezpR8 yuGNY7bKNFAQEEf0xUSytAs3gMBc4u15uI2XzrTxi+erWfqAKY/h7LT5UTxNkbx4WyQw r6EcLiLoLekJVYlqJbwkn05ptOyKaI2zi+K9fGoFPbxoknLqG5d1GFe0h3OFc8ihBRFk wYhOL79cUh/HW2pkyPlpLdSn5grh5J559oBqc5z8kWuWdGBjitmeIZ5ZXagwqEx+Acv5 rREA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DYXidhXetMjXM/69kCk3cxYSpCrg2+4xkE3MVSwGjbM=; b=exy5mVdE52KFcLfaZp8zvIlbP9oprHzqFs4YdWj75WSB0WOijrND9WeL5fNBu6uWJc b1sjLgGvBK5i5pLvKnoRJ0zY4P8p/LlLXukLxwwouvM82uxoJ8M/kCK4YqHrb2W2c9oI 18EaLclZurgm+AUFdfZ3ERUhjirNilx/ugkescSM3iXZadG03hVVBJHMfpJoqPfr5r9V fiI+YqIRHpro9JAi+8K99/DbMYBG3+SCc9gELBDbNajNbWY9FzKriREMQGPmjm50C2rK VSgzDvG4msSez2vKDVB4hNzcmDwR0QaJYxAKF4CmuostB92kf3ISBFCnUNCqrRBt+Fd/ 2MNw== X-Gm-Message-State: AOAM532y5RhwnR3ic4S6ylvFAgTHC9sHEraYPw2wCMozlG4WyZbaJYRJ sIRD+6xqzsYnucgYHp0k3zkZpkkAlCv4us9j0w0= X-Google-Smtp-Source: ABdhPJzNsFVMJq5Q0rrktASC7JgiN0/36paqf8Oy7f6v8nKQoAM23H3fjHVzfU/ZtIxafNr+PDA/pNJujZZsRz8bu4E= X-Received: by 2002:a17:906:a449:: with SMTP id cb9mr12123349ejb.115.1593769772748; Fri, 03 Jul 2020 02:49:32 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 3 Jul 2020 11:49:21 +0200 Message-ID: To: Benas IML Cc: PHP Internals List Content-Type: multipart/alternative; boundary="00000000000028941205a98671fc" Subject: Re: [PHP-DEV] [RFC] [VOTE] Make constructors and destructors return void From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --00000000000028941205a98671fc Content-Type: text/plain; charset="UTF-8" I think that Larry's and Rowan's replies on the original discussion thread > really well explained as to why it makes sense to allow an explicit `void` > return type, so I'll just quote them instead ;) > > Larry: > > I see this in the same category as __toString(). > I read those yes, but there are subtle yet critical differences to me: in PHP < 8, 1. the return-type of __toString is already enforced by the engine (just not by the type-system, but the end result is the same) and 2. it is already allowed to add the "string" return type to the method. for constructors/destructors, neither 1. nor 2. are true: they *do*not* allow any return type and they don't check the return value. This means that the change on __toString is mostly transparent (only the exact error message is different), while the proposed change is not. It will have a cost for the community, and my opinion is that this cost is not worth it. > Any constructor returning non-void right now is Doing It Wrong(tm) > That's precisely what I read as "gratuitous strictness" (no offense to anyone, I respect this opinion.) Especially when this might become "enforced". > Since some internals told me that PHP doesn't follow semver strictly, it > would make sense to enforce the check in PHP 8.1 already. > I invite you to read https://wiki.php.net/rfc/releaseprocess where this is detailed. Here is the relevant excerpt: "x.y.z to x.y+1.z" => "Backward compatibility must be kept". A dedicated vote in a specific RFC cannot overrule this policy AFAIK. Thanks for your answer, Nicolas > --00000000000028941205a98671fc--