Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115806 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 65256 invoked from network); 25 Aug 2021 10:31:39 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Aug 2021 10:31:39 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5EBC91804DB for ; Wed, 25 Aug 2021 04:05:48 -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, 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-vs1-f47.google.com (mail-vs1-f47.google.com [209.85.217.47]) (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 04:05:45 -0700 (PDT) Received: by mail-vs1-f47.google.com with SMTP id b5so12059072vsq.2 for ; Wed, 25 Aug 2021 04:05:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=JSi564cQD0HrRydc+0pPkQ9FTdvEEDw8F9g5bp9S7U8=; b=lxvWLIcqlYqB1Ht/0/p+7DeoJujUPt7DdO8PQeKFJ+5kGsY3s92KdMXPAlh5sbM8i5 trguGOfh808Wk1hK5i+rNuB84MnvLnIN8Clu+khxk6UxdraNN/zn3VcY9kwXJrKfKDAd grsGCbbOlBKnRqY+gObOAKr8x/B8dpBCdaRPPiats+VugPB4913gFNtDkGx2YBmjgYj0 sat5IE8FHlSCB0DIkvj+VwKmZykhOHgyZTTT+jFOBdfIvkv8XzY3AtIgu3YuOadtiK6Q qAQt8MlOPWshr0Rx64/hj2wH12KbmGQq5+NfDsvwlNqbFXxg6/EIT72gm2BJUETKBBp2 ULBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=JSi564cQD0HrRydc+0pPkQ9FTdvEEDw8F9g5bp9S7U8=; b=NHh0607/t5DLy1R/kBZB36F+auMiEKBXxX17X8G8l8RXJJbTrOFJfEHLT4+4uqohxq d8bUwVgG3/cq/I2qb5WDMD/PvVUx4837taUI8kG+U2BpSdBVHNGB5ren++VWD4CmCYF6 j85lIu7qCFG9z7JpRqfVxE5nsrkyCEnOcZqwo3fZd2fb76ze40ivf88aDRlD2Or7MqMg RyK1wOLJJ2j/M/ufAVwmpSl1oxR/P1Rr+xMvdxxkmvdk1wjXW0UYbpmYgnwO1S9uu8uG qS1jTc8zQTA+0WZv1ECMzZUqZ8coFQYaaM8ChQIY09V04+sdSRu34GDhXA1hplEDyUlu CVIQ== X-Gm-Message-State: AOAM5330jrJe87WGmGuUBU1YX92P75QRLPqK1DIBO6mEGss2qC1Ops3n DrGehDuFbkCMxJ3X1IBWF5qbcD3In7z1Ukgdy/k= X-Google-Smtp-Source: ABdhPJx0vC7XwtwfM+yRK//9icdyKHB2x5QxQ9LtmDbAtD0Be65jmcCpmpqdqn90XDNd0cApA9eoe5ahG1dLF3BKqiA= X-Received: by 2002:a67:e983:: with SMTP id b3mr89646vso.9.1629889542015; Wed, 25 Aug 2021 04:05:42 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab0:7687:0:0:0:0:0 with HTTP; Wed, 25 Aug 2021 04:05:41 -0700 (PDT) In-Reply-To: References: Date: Wed, 25 Aug 2021 16:05:41 +0500 Message-ID: To: Rowan Tommins Cc: internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] Deprecate dynamic properties From: office.hamzaahmad@gmail.com (Hamza Ahmad) HI Nikita, What if you consider this instead? Rather allowing STD class as an exception to dynamic properties, why not introduce STDAbstract? ```php interface STDClassInterface { public function __get(string $name) : mixed; public function __set(string $name, mixed $value = null) : mixed; /* * other magic methods */ }; abstract class STDClassAbstract implements STDClassInterface {/* * interface methods */} Class STDClass extends SDTClassAbstract{} `` Best Hamza On 8/25/21, Rowan Tommins wrote: > On 25/08/2021 11:02, Nikita Popov wrote: >> I'd like to propose the deprecation of "dynamic properties", that is >> properties that have not been declared in the class (stdClass and >> __get/__set excluded, of course): >> >> https://wiki.php.net/rfc/deprecate_dynamic_properties > > > This is a bold move, and in principle seems sensible, although I'm > slightly scared how many places will need fixing in legacy code bases. > > I have a couple of concerns with using stdClass as the opt-in mechanism: > > * The name of that class already leads to a lot of confusion about its > purpose - it's not actually "standard" in any way, and new users seeing > it as a base class are even more likely to mistake it as some kind of > "universal ancestor". Would it be feasible to introduce an alias like > "DynamicObject" which more clearly defines its role? > > * Adding a parent to an existing class isn't always possible, if it > already inherits from something else. Perhaps the behaviour could also > be available as a trait, which defined stub __get and __set methods, > allowing for the replacement of the internal implementation as you've > described? > > > Regards, > > -- > Rowan Tommins > [IMSoP] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > >