Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115814 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 84459 invoked from network); 25 Aug 2021 13:34:02 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Aug 2021 13:34:02 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 89DF31804DB for ; Wed, 25 Aug 2021 07:08:13 -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.5 required=5.0 tests=BAYES_00,HTML_MESSAGE, KHOP_HELO_FCRDNS,SPF_HELO_NONE,SPF_NONE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS16276 94.23.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from processus.org (ns366368.ip-94-23-14.eu [94.23.14.201]) (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 ; Wed, 25 Aug 2021 07:08:12 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by processus.org (Postfix) with ESMTPA id 8A7EC5101324; Wed, 25 Aug 2021 14:08:06 +0000 (UTC) To: Rowan Tommins , PHP internals References: <763725c0-870b-e8c4-054b-1ea0481ef877@gmail.com> Message-ID: <23055540-3829-6952-5c92-588eb90b699a@processus.org> Date: Wed, 25 Aug 2021 16:08:04 +0200 MIME-Version: 1.0 In-Reply-To: <763725c0-870b-e8c4-054b-1ea0481ef877@gmail.com> Content-Type: multipart/alternative; boundary="------------160A1A2AFA6C7281F482794B" Content-Language: en-US Authentication-Results: processus.org; auth=pass smtp.auth=pierre-php@processus.org smtp.mailfrom=pierre-php@processus.org X-Spamd-Bar: / Subject: Re: [PHP-DEV] [RFC] Deprecate dynamic properties From: pierre-php@processus.org (Pierre) --------------160A1A2AFA6C7281F482794B Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Le 25/08/2021 à 15:51, Rowan Tommins a écrit : > On 25/08/2021 13:45, Nikita Popov wrote: > >> We obviously need to keep support for dynamic properties on stdClass, >> and if we do so, I would expect that to apply to subclasses as well. > > Does that actually follow, though? Right now, there is no advantage to > extending stdClass, so no reason to expect existing code to do so, and > no reason for people doing so to expect it to affect behaviour. > > >> Second, I consider "extends stdClass" to be something of a last-ditch >> option. If you encounter a dynamic property deprecation warning, you >> should generally resolve it in some other way, and only fall back to >> "extends stdClass" as the final option. > > > That's a reasonable argument in terms of the multiple inheritance case. > > My concern about the name remains though: people already do get > confused by the name "stdClass", because it's not in any way > "standard", and tells you nothing about what it does. > > Reading "class Foo extends stdClass" gives the reader no clues what > magic behaviour is being inherited; "class Foo extends DynamicObject" > would be much more clear. Similarly, "$foo = new DynamicObject; > $foo->bar = 42;" is clearer than "$foo = new stdClass; $foo->bar = 42;" > > Regards, > Hello, And why not adding an extra keyword, such as: ``` ``` Regards, -- Pierre --------------160A1A2AFA6C7281F482794B--