Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114391 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 60734 invoked from network); 11 May 2021 14:37:38 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 May 2021 14:37:38 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 396DD1804B1 for ; Tue, 11 May 2021 07:45:26 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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-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, 11 May 2021 07:45:26 -0700 (PDT) Received: by mail-lf1-f41.google.com with SMTP id c3so29025083lfs.7 for ; Tue, 11 May 2021 07:45:26 -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=W5sm2py1U8oT60jlOHBVe0UoMTjsvXkNs7s+SeVWWVQ=; b=c7mgI4tAStUpaAq2zKKgwfjXFIBSyPOmqV+/BriG8a5Ew4Ce6W+xcQrXxQsWTcknlG UrgyDtYX4Uj3U0f6yV3UbE8fZg/YKOS01uIdpXVr+Zc+gZH/Hv3dppQMFuRzkpPEC+y3 PfKTLtKZL2nsocDb0QA5OGL8GTIjJewxRCVUvE3vgbS76uXof4d83uuQxHyFlnKxOP8n APuUqt3037U6SvStUkE2pl3gPYnX7x/a40CwT79Lb/jgkx8O/nq7vx+ylA3tuRx22zvo tgobcYOousmjwvbs51VhgfavK6mfAVqlJQyoA4LoXncNtigpMdYUwshKL/r84VLOvbk6 pelA== 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=W5sm2py1U8oT60jlOHBVe0UoMTjsvXkNs7s+SeVWWVQ=; b=VjZG6ArkO+y5rAymtsVGpH4iHdaMc6MHc6vdcsdvw62GaJS/7DdhuD4lhWcTj7AHmh ZPnwDE1WIwTK7rDbePQb1V3piQl+jTUTH3v+gBA1kE2hkU0/ohkzdAmtOMMOeYHUGzQN HWJLNKXoZtCeIwCa+ub3HgIFBNFjvwKW1kGt5HWVcOp1lRXW6/vnMn73dcc0lXc9GGND r+8Gs6/qX3X1ReGwH3aMHW4fPY2BKMpL1hJM5gO5tt7LxqAkx1eFPBWECFZjiuEgwYKs l1mEHaTBgRGLXQYHaQohQJv2NvfqM6dJcog3FwUud/etlqzAmfg1USURn+4Ze4Sj9TcE STWA== X-Gm-Message-State: AOAM532UrvRR/E9kfhvJUWC74a4sRYuuBmgiBHeWG+P81BcrVOW4SXni 9p5cBUarYT/GeyZ0ehycB2d7qcE5GfKrynNzGD8= X-Google-Smtp-Source: ABdhPJx+4EigNHlloLzotVbXxHlmSIFfJ0J2ZQsqxNZwoAW3ISB7xqmYt48d80szQEUsvIa4MfwcP4ljZeip24GmUvo= X-Received: by 2002:a05:6512:acd:: with SMTP id n13mr13017367lfu.485.1620744324643; Tue, 11 May 2021 07:45:24 -0700 (PDT) MIME-Version: 1.0 References: <1620635361.9147.0@gmail.com> <20210511163711.122e46c1@mcmic-probook.opensides.be> In-Reply-To: <20210511163711.122e46c1@mcmic-probook.opensides.be> Date: Tue, 11 May 2021 16:45:08 +0200 Message-ID: To: =?UTF-8?Q?C=C3=B4me_Chilliet?= Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000bdff1105c20ef134" Subject: Re: [PHP-DEV] [RFC][Draft] Body-less __construct From: nikita.ppv@gmail.com (Nikita Popov) --000000000000bdff1105c20ef134 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, May 11, 2021 at 4:37 PM C=C3=B4me Chilliet < come.chilliet@fusiondirectory.org> wrote: > Le Tue, 11 May 2021 10:58:57 +0200, > Nikita Popov a =C3=A9crit : > > > If we allow it, I would restrict it to specifically the case of a) a > > promoted constructor b) which has *only* promoted parameters. I don't > think > > we should allow replacing "{}" with ";" for methods in the general case= . > > This would create a subtle difference of allowed syntax between a > constructor > and an other method, and between a constructor with promoted parameters > and > without. I think we should avoid this. > > I even thought we merged changes to make constructors more like the other > methods, but I just checked and it seems the RFCs to allow ": void" on > constructors were declined. > My thought here is that a constructor with (only) promoted properties is hardly a constructor at all -- it's more like a special syntax for declaring properties that happens to re-use the constructor notation, because that allows it generalize in certain ways. It could have been implemented with some other syntax that didn't explicitly mention constructors at all, such as class Point($x, $y, $z) {} or something. I don't think there's any particularly good reason to have a body-less constructor outside the promotion case. The example given by Bruce private final function __construct(); is going to throw a warning since PHP 8 -- while I lobbied against that decision at the time, final private methods no longer have an effect, and declaring such a constructor will buy you nothing apart from that warning. If a body-less non-promoted constructor is used, the most likely assumption would be that the programmer forgot an "abstract" modifier. Is there some use-case for empty constructors that I'm missing here? Regards, Nikita --000000000000bdff1105c20ef134--