Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109642 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 70665 invoked from network); 14 Apr 2020 21:33:01 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Apr 2020 21:33:01 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 74B2B1804E2 for ; Tue, 14 Apr 2020 13:02:44 -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-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (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 13:02:43 -0700 (PDT) Received: by mail-lf1-f44.google.com with SMTP id u10so772713lfo.8 for ; Tue, 14 Apr 2020 13:02:43 -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=blhP9sAc7o/kIuzXNo3cH5bMP4I3nV9sMy21Ch6RR6Q=; b=IFxszodPWnIijxfOTCtJ6ndECrtfg+ceBlyW7FYp7LFyWPNyawMLs8FsFxznOOGbjD LDpY48eDDQokDhj5HJ7Hy//BLoQlW2YEa82qk7b8VYWyuOSlutRh1o+pQ10qpcc1lTD6 6enr/zu8g80j4EeAEgc8hLEiaXATbNk2CEtHNCCju/oUG11qWH/ApQRxGmEAb+uvYDLw 1bZKFmB4WfcbOBgiWCLVoQFew+L3Teb2LBq+EYw1XAkYtw8AWSFAzcwFu43J9m8/yeFR /4iDj5JAV0ouhhMWSVA/czoozIJzhPJaoHgXt15s78X6pNSeEEmooiK7oORy1a6Pbkgz 3e0w== 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=blhP9sAc7o/kIuzXNo3cH5bMP4I3nV9sMy21Ch6RR6Q=; b=lKALwIFbIdJk3oRTiaP6Wi9x71LaTZY2pI8RVi2tkqUxsYBFOSl93zqwfqYGby22FJ xQBBmmgDzvp8d/nKLtMns3n7U6bj4ixcBpDioyinuu5mwrjXVDkxaEcHtEVkP+a944TI Ou884ycBhR6NzUCYFsLJHIm/m2qurkpSpVEJbQIpsbUkQMItl1DyPbee0MC8o9VE0vV4 V27M3eTaU3N/u+YOonWtVmkyzmX3XvV8TZIqAPDoob7kvkHqPZ91V5zh94fxxJVPr3iY a/ouwU8VvN5wve5GfC3m2YLg4rqydIJ8GakCXioLLoO0SocwRnYUXOgjwzQsXJ6I1nsh brIg== X-Gm-Message-State: AGi0PuY49rJspvXtwbduQ1/8x5gudjDujyAOzas+MVcehTJTZ/rmr9BO HreybnKiytJyeyOgOYzl4Enfyxgo4W502YgEHrU= X-Google-Smtp-Source: APiQypLYUoAtfs5BTdMIOHLHLvjxYqzqejpkoWVBCKNzMhR7mYOCHQfZm+PWsHmLSqnktAA9JOyZmojglPx/Oei1xoU= X-Received: by 2002:a19:1c3:: with SMTP id 186mr832034lfb.191.1586894562402; Tue, 14 Apr 2020 13:02:42 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 14 Apr 2020 22:02:25 +0200 Message-ID: To: Dmitry Stogov Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000b029be05a345ae8d" Subject: Re: [PHP-DEV] Re: [RFC] Constructor Property Promotion From: nikita.ppv@gmail.com (Nikita Popov) --000000000000b029be05a345ae8d Content-Type: text/plain; charset="UTF-8" On Tue, Apr 14, 2020 at 9:17 PM Dmitry Stogov wrote: > Hi Nikita, > > Personally, I don't see a big reason in introduction this syntax sugar. > It allows to make class declaration more compact but less readable. > > Also, this feature doesn't work well with inheritance. RFC doesn't provide > any examples with inherited classes. > The implementation doesn't allow initialization of parent class > properties, and doesn't allow to call parent constructor before > initialization of child class properties (like C++ allows). > I have now added an example involving inheritance to the RFC: https://wiki.php.net/rfc/constructor_promotion#inheritance Constructor promotion does work with inheritance. As you pointed out, the only oddity is that properties are assigned before the parent constructor call, rather than after it. I don't think this makes a difference in practice though. > In my opinion, the existing PHP syntax is already clear and good enough. > Fair enough :) Nikita ------------------------------ > *From:* Nikita Popov > *Sent:* Tuesday, April 14, 2020 16:02 > *To:* PHP internals > *Subject:* [PHP-DEV] Re: [RFC] Constructor Property Promotion > > On Thu, Mar 26, 2020 at 2:30 PM Nikita Popov wrote: > > > Hi internals, > > > > I would like to submit the following RFC for your consideration: > > https://wiki.php.net/rfc/constructor_promotion > > > > This is based on one off the suggestions made in > > https://externals.io/message/109220, and some existing discussion on the > > topic can be found in that thread. > > > > The primary motivation for this feature is to close the currently rather > > wide gap between the use of ad-hoc array structures, and the use of > > well-defined and type-safe value objects. The latter is what we want > people > > to use, but the former is, unfortunately, what is *easy* to use. > > > > As the reception has been positive, I plan to open voting on this proposal > soon. Please tell me if you have further concerns or the RFC needs > additional clarification. > > Regards, > Nikita > > > CAUTION: This email originated from outside of the organization. Do not > click on links or open attachments unless you recognize the sender and know > the content is safe. > > This e-mail may contain information that is privileged or confidential. If > you are not the intended recipient, please delete the e-mail and any > attachments and notify us immediately. > > --000000000000b029be05a345ae8d--