Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109641 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 55439 invoked from network); 14 Apr 2020 19:15:40 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Apr 2020 19:15:40 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 970FE1804DD for ; Tue, 14 Apr 2020 10:45:23 -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-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 10:45:22 -0700 (PDT) Received: by mail-wr1-f46.google.com with SMTP id j2so15452380wrs.9 for ; Tue, 14 Apr 2020 10:45:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=ABjQMCKUbeIBf/b408GVZ/UY9fd4/9oZYJ6vGoRQv4Q=; b=dbee9XZC5d0zpPKqeeASxq9q+9UVbhZPpS/kkAhF+r+fcacxLAjOXgbnTWh5mizERj Qzqi/mYqtIDOxr7BOvBVLPnU7MSyYXnrAyBAnPG7uQ1dVGrkiUyciIhDJKjAkfmLT8gP WoeioFx36V0/aCQbxpTZ8S7Hv38MQJXx+PdP1TaDDhP5GuO494Om/MXo94ZEhTksWTSh K81rv/wfvhyGBsXERB6puOLogjObJwkTo6TcKUk5ag3oU+LCRqzMt0VH/RVtc+6fP3K6 9r/UTOkvsntYnh4T2BMhsDNslj7aE7kpW98CzpgEj86BmBW11AgNUb20aty8311D+rAm ewpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=ABjQMCKUbeIBf/b408GVZ/UY9fd4/9oZYJ6vGoRQv4Q=; b=GZmBc8mAk8wd8OkgGDfGY5OXynTXWWWTCxtjs5KhXFNQamyesdjjGwjmWniTnQLH0M uDMed6iF1FCm488WTT1sK06l4SkDbTQdYt/qVL1+wnSjc7VbmLwgzQX1LtYUzjXKiiSs jC1qgb+dXtwzPx+cnTNJWDb8Vp7ls8mah4wR+nwUl5b07P31OZcygHvOYljYuGOdnoSd YHqf/mc3/DVWFvNw+NlLGGTeWB12ILVG73Nu+N/mm1jWQ6cSxHZdF4hB+VC4I7TNpo7L 9lB2whcN3b1KlBwFWP5pOxecIxbR3zfgCSsmStIWF4ttR8KOMYqsveTqz4wsIH4tMK0x Df3Q== X-Gm-Message-State: AGi0PuZhIg/nar2QIIARj2CfFHS46M5aAxrzYgeGimUB/4tKAZZcnzMF CbWtWeSYQHqBzid9QDRQ5Uc= X-Google-Smtp-Source: APiQypIss/Ss+5X0AO2Mvx+kacaF03R66ddytVCO+AZcexeDINhGtC9J2vs8OF/A/ea/IEVPu9lfOA== X-Received: by 2002:a5d:61c2:: with SMTP id q2mr26842224wrv.152.1586886319490; Tue, 14 Apr 2020 10:45:19 -0700 (PDT) Received: from claude.fritz.box ([185.71.12.64]) by smtp.gmail.com with ESMTPSA id 5sm19256260wmg.34.2020.04.14.10.45.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Apr 2020 10:45:17 -0700 (PDT) Message-ID: <436FD800-A316-4C99-8793-C6EF4BD15BE3@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_FC621D49-FD78-4597-AC2E-F5E2EA282FC0" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Date: Tue, 14 Apr 2020 19:45:16 +0200 In-Reply-To: Cc: Nicolas Grekas , Gabriel Caruso , PHP Internals To: Nikita Popov References: <90F4B395-F010-4196-9C40-7896D4F3F2F4@gmail.com> <0A374409-6FA6-4E02-A7E6-EACA3E42451C@gmail.com> X-Mailer: Apple Mail (2.3608.80.23.2.2) Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Ensure correct magic methods' signatures when typed From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_FC621D49-FD78-4597-AC2E-F5E2EA282FC0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Le 14 avr. 2020 =C3=A0 18:53, Nikita Popov a = =C3=A9crit : >=20 > On Tue, Apr 14, 2020 at 6:07 PM Claude Pache > wrote: >=20 >=20 > > Le 14 avr. 2020 =C3=A0 16:54, Nicolas Grekas = > a = =C3=A9crit : > >=20 > > 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 of the code style choices this will open (and the CS "wars" I = mentioned). > >=20 >=20 > 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. >=20 > 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 void=E2=80=9D. >=20 > 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 = = > . But again, the issue = is orthogonal to the fact that this particular method is magic, and we = should not cherry-pick and reject the concept of =E2=80=9Cvoid=E2=80=9D = for __construct() and similar magic methods only. >=20 > 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. >=20 > 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? >=20 > Regards, > Nikita Do those languages allow to return something from the constructor (as = does PHP currently)? because I=E2=80=99m more interested in the = semantics of `: void` than the exact way to have it. =E2=80=94Claude --Apple-Mail=_FC621D49-FD78-4597-AC2E-F5E2EA282FC0--