Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114411 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 96064 invoked from network); 11 May 2021 16:48:41 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 May 2021 16:48:41 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 21D061804F4 for ; Tue, 11 May 2021 09:56:31 -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-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (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 09:56:27 -0700 (PDT) Received: by mail-lf1-f53.google.com with SMTP id x2so29615989lff.10 for ; Tue, 11 May 2021 09:56:27 -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=zsH3iJfSQxaZYVi14UIuazckIr7DQ2tF9B/FnuDXtIA=; b=sR9GxrWw/wP+fnZxFoRTS/AiSmVwPBg1t+13zvwfcedKfbzGUHkBObQuNyxlEAmEWO ny+mjXqkQem/UhU6zeVCDaUQ3CltlaiBpbcCUEKZbmkhmBKZ+N2TUtvvfwhggBDRz/Mq oRYpYC/WhtlhiYgRJivck7EpXFeB7+q9B6OLHFjxjtKZ6LpKYPI/XOdp6D5xnj3x22dU vLgPTDZb3+UGZRkqS+p5k3vOM355vwXVaAkzWV0XOUi7q9x6uRE3zEJJmfP/RmJGq17j xK9yvzaKo8Q4stiMoo0NDcXIPJuj6p5UFr0lGk2/DuaHnfTkMKlu1pXvTGFP4zckIN4P o3VA== 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=zsH3iJfSQxaZYVi14UIuazckIr7DQ2tF9B/FnuDXtIA=; b=MQRYMSuqO53emCDfL3FXYtrf+v+uQa16x0e4oKxF/W9t39+L6KphfDz51eq2qUnxfb X4kX4rUP9AnasMk2+CqC5In3dFCv5aSW7xxwEzEFmejs/vW+WhHfxU8Nxu9Vv8rJAO0N MP6Rwsgiii1A4SFu0M/sGM8VlCM0ew/yBI0Ck4UuOjvqSv5z6az8A7Um/1nzOWrxP7vs UE5vWdz0dIieKDrzP3rghMfGVLdTWvQzhAYdNbfYR5Xaz585Q5MwZnMuZSSslfiwoQPF OdNEy0cONwVwjYGhOlkB50eNONo7b88OgHzP8H5BLPgAbnvsmS7r5U5wciIHFv1CkQOI 44Uw== X-Gm-Message-State: AOAM532MxlVQmfPC/Vuh1j1jFnQqSEp2XDwCHds7GyFf8pxRmAwDMNX6 ZkN7BRsjs6HY/F4xSmmYrqWCKPHaFwWlVxvHVqg= X-Google-Smtp-Source: ABdhPJxsGHH0DxVuNppkzPTvMUrS21PECbrA9dB+GTizuqs+R6ZyzvjQ2BajLZ6k5NfjC8MlEjDokR59anPumIVZeLg= X-Received: by 2002:a05:6512:2253:: with SMTP id i19mr21236365lfu.92.1620752185995; Tue, 11 May 2021 09:56:25 -0700 (PDT) MIME-Version: 1.0 References: <1620635361.9147.0@gmail.com> <20210511163711.122e46c1@mcmic-probook.opensides.be> In-Reply-To: Date: Tue, 11 May 2021 09:55:59 -0700 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000050b39905c210c6e8" Subject: Re: [PHP-DEV] [RFC][Draft] Body-less __construct From: matthewfonda@gmail.com (Matt Fonda) --00000000000050b39905c210c6e8 Content-Type: text/plain; charset="UTF-8" On Tue, May 11, 2021 at 7:45 AM Nikita Popov wrote: > 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. > Agreed. I've personally been a little hesitant to start using CPP because of this. Declare constructor parameters AND declare properties AND magically provide a constructor implementation that sets their values. It looks like a constructor, but it's actually a little different. For me, this proposal would really help clear that up. When I see a method with an empty body, I think "this method does have an implementation, and that implementation does exactly nothing." In the case of CPP, this isn't true. The method appears to do exactly nothing, but in fact it has an automatically defined implementation that sets the properties to the given values. When I see a semi-colon-terminated method, I think "this method has no implementation *here*; one will be provided from somewhere else." This is the case in abstract classes and interfaces--the subclass provides the implementation. And it's the case in CPP too--an implementation that sets the properties to the given values is automatically provided. For this reason, I don't see it as inconsistent. The semi-colon means someone else will provide an implementation, and CPP does just that. Regards, --Matthew --00000000000050b39905c210c6e8--