Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109638 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 45897 invoked from network); 14 Apr 2020 18:24:25 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Apr 2020 18:24:25 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CCE3C180509 for ; Tue, 14 Apr 2020 09:54:03 -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=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,FREEMAIL_REPLY, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (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 ; Tue, 14 Apr 2020 09:54:03 -0700 (PDT) Received: by mail-lf1-f41.google.com with SMTP id l11so310399lfc.5 for ; Tue, 14 Apr 2020 09:54:03 -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=xLH5yuC6zdLJc1GEfCE9WvQsnhkF1o7UIFcIA/I2O/A=; b=n7dq4wc3NZHF9mrt6e63/EhmJes/oVYtly4mbJ8+Sg2cdvSYSqVuaDM1F/CGQmKqUr d86HjXKHGqusWhAgHW42isiN6/OKKQwgDtSuK4I53M4uaCbZV770Z9adsu+zen6RcXfJ +kcDrb2/4+M2HUcvlXzC5q5YJtUBjaH4T4/l9bsgMEFkp5SxGBspSfuHDHKr07Dxkqbo ClplDvHaTaciPu17FF+ByMhqqQiHj5CZkkJpoesfTB5CojESqu9sML8peF8wZqlzcxX4 7YS8Y0ZknMUVVCt0U00AuWt7WGVAHoxTQL2ThLxXMGCJZhnEcnl4WgRUN0bNUEYBSznu D6UA== 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=xLH5yuC6zdLJc1GEfCE9WvQsnhkF1o7UIFcIA/I2O/A=; b=eCukX7QAjoV/v3oRUEKY5I8sV3JNe4Apws39mo0Ny7DAgzNfRZenjt+pCU/r7RUiYR dh0OTEJOkgnRBi8JRH2x9wb5xcZdsan3j6j9TvAZNXU7eiAwbQ3ICjiUd7o0wEomwkQ0 cZ8rnr1LVcM4au0mX7YcoJ3nJ+xH/a2qHBWtnTf0MTS27x9P80HPNFCPMELNu66JoXkP Rw3fDTSnrV7cQNxPcvBjQnp2jI9jaKPlkAoxHh6tzMiaaB4CE/hGQiVnp7WZH/wktwja P8nziX2VVLJKfZD3ILB4qlicYz4CTdAOoHhdwhPaS/531CxtDWxWDLMaG74pZfdj3Qd+ 4rUA== X-Gm-Message-State: AGi0Pubq5xfGu3WvxBxtWg8QAwmUDucX84P5wuSBqvOwcMFja1goEEa5 /Lz3fZLAfY/cetKxL9haXxZLEQgpUOr6+Dosc3s= X-Google-Smtp-Source: APiQypK7TgvM9v/fSL1ZIgaWgNYc0b0QqDBwOhOBpqHL4HIkaSQNoQ+UIZob4PZpfz3YdjbBaEaiFPEn6C0pDIUGSxM= X-Received: by 2002:ac2:5f92:: with SMTP id r18mr468591lfe.154.1586883240834; Tue, 14 Apr 2020 09:54:00 -0700 (PDT) MIME-Version: 1.0 References: <90F4B395-F010-4196-9C40-7896D4F3F2F4@gmail.com> <0A374409-6FA6-4E02-A7E6-EACA3E42451C@gmail.com> In-Reply-To: <0A374409-6FA6-4E02-A7E6-EACA3E42451C@gmail.com> Date: Tue, 14 Apr 2020 18:53:44 +0200 Message-ID: To: Claude Pache Cc: Nicolas Grekas , Gabriel Caruso , PHP Internals Content-Type: multipart/alternative; boundary="000000000000debc0105a3430b48" Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Ensure correct magic methods' signatures when typed From: nikita.ppv@gmail.com (Nikita Popov) --000000000000debc0105a3430b48 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Apr 14, 2020 at 6:07 PM Claude Pache wrote= : > > > > Le 14 avr. 2020 =C3=A0 16:54, Nicolas Grekas > a =C3=A9crit : > > > > I'm just not sold on allowing "void" on __construct, because the very > concept of a return type on a constructor is ... void, and also because o= f > the code style choices this will open (and the CS "wars" I mentioned). > > > > This issue is not specific to magic method like __construct(). It is the > whole concept of =E2=80=9Cvoid=E2=80=9D as return type which is, say, =E2= =80=9Cproblematic=E2=80=9D. > > In fact, =E2=80=9Cvoid=E2=80=9D is not really a return type. It is a way = to state that the > method is not supposed to return anything, which means, as you said very > well, that =E2=80=9Cthe very concept of return type on [this method] is v= oid=E2=80=9D. > > That might be a reason to reject the concept of =E2=80=9Cvoid=E2=80=9D as= return type. Or > to revive https://wiki.php.net/rfc/allow-void-variance < > https://wiki.php.net/rfc/allow-void-variance> . But again, the issue is > orthogonal to the fact that this particular method is magic, and we shoul= d > not cherry-pick and reject the concept of =E2=80=9Cvoid=E2=80=9D for __co= nstruct() and > similar magic methods only. Constructors not having a return type is standard behavior across most (all?) languages. You can't specify a constructor return type in C++. You can't specify one in C#. You can't specify one in Java. Off-hand, I can't name a language that both has a first-class constructor concept (Rust's "new" idiom does not count) and specifies a return type on it. It would naturally follow that, yes, you can't specify a constructor return type in PHP either, just like we enforce right now. Unless we have some strong reason to deviate from standard behavior that I do not see? Regards, Nikita --000000000000debc0105a3430b48--