Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116335 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 69947 invoked from network); 12 Nov 2021 20:47:47 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Nov 2021 20:47:47 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B1C521804BC for ; Fri, 12 Nov 2021 13:41:49 -0800 (PST) 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.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS19151 66.111.4.0/24 X-Spam-Virus: No X-Envelope-From: Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (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 ; Fri, 12 Nov 2021 13:41:49 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 5AF685C0174 for ; Fri, 12 Nov 2021 16:41:47 -0500 (EST) Received: from imap43 ([10.202.2.93]) by compute6.internal (MEProxy); Fri, 12 Nov 2021 16:41:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=EANR30 7CAblcPhQjsmTvjLBtJNW4DC4J0qmEg/zakFI=; b=JWI/6Te+K1A56WUsEzPnBK 50azeV3E5H6CETl3JlasflhXrLzFQm5o6wPJ1ry0caELJYF/ukwTnk8McBjNsfF+ ytJRFkIUYMtb6T3Y5M7BdDtFsMshT8RbIPl5NSV5AOkjeRp/NaBNNNiyETh4fA+k qK0OQ428kcZIe9U24cvQ9DjpagbwvSxAYkd+OlyqCfK6VOhDLFNw/Skda3W7YdPI 8bULGdjYU6DI9Ev83fvLmmOQS+coF/t2NU7RdEqPl++Ry164sQCF/72h+J6lQ8qp ON55ovW8AMqg7OqzgFX+JdYDemLnQ7360AupG4uBLYCmQQwJXWap1FdZiCmfUSrA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrvdefgddugeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpeeglefgkeduiedvvdetffeujefftdfhjeeiveehgfff keduveektddvledvvdfffeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 2480AAC0DD1; Fri, 12 Nov 2021 16:41:47 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-1371-g2296cc3491-fm-20211109.003-g2296cc34 Mime-Version: 1.0 Message-ID: In-Reply-To: References: Date: Fri, 12 Nov 2021 15:41:25 -0600 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] [VOTE] Deprecate dynamic properties From: larry@garfieldtech.com ("Larry Garfield") On Fri, Nov 12, 2021, at 12:59 PM, Matthew Weier O'Phinney wrote: > I recognize it's a bit late to be commenting, now that voting has > started... but this feels like a solution for which we already have > workable solutions, and which will instead lead to a lot of > misunderstanding and breakage in the user ecosystem. > > Our IDEs, coding standards, and static analysis tools can already flag > these things for us, helping us catch them early. Hell, unit testing will > find these for us, when a test fails due to a value not being set in a > property that we expected. > > Making this fundamental change to the language means, however, that a lot > of things that we were previously able to do that "just worked" now raise a > deprecation notice, and, later, a compilation error... unless we make a > change to our already working, fully functional code. > > I think the Locked Classes approach made far more sense here, because it > didn't require changes to _working_ code. By making the behavior opt-in, > developers get to choose if that's what they want for their classes, > instead of having a backwards breaking change thrust on them. > > (Perhaps an even better solution would be a declaration, like we have for > strict_types, which we could do per file.) > > Or maybe I'm missing something else: was there something at the engine > level that was driving this, a significant performance gain we get from > changing the behavior? Because if there was, there was no discussion of it. > In fact, the only discussion of "why" in the RFC is "In modern code, this > is rarely done intentionally". Why is that justification for changing the > behavior? Can you quantify how much code would be affected by this change? > and how much would benefit? > > Yes, I know that code I write would benefit from it, and personally I'd > love to have a way to opt-in to something more strict - but I think a > switch like this is going to make upgrading to version 9 difficult if not > impossible for a huge number of PHP users. > > Sweeping changes like this need data behind them. If there's such data for > this RFC, it's not present in the proposal, and as such, I cannot > understand what drives it. The original version of the RFC would have (as of v9) allowed for the removal of some fugly code in property handling, resulting in engine improvements and some minor performance benefits. That was because it pushed the opt-in mechanism to "only if you extend stdclass", and stdclass would effectively have a trait with stock __get/__set implementations to handle dynamic property behavior. (It wasn't quite that, but effectively that's what it would do.) So that was the original impetus. The current version doesn't actually remove the behavior yet, so it wouldn't allow for that optimization. That does, I agree, weaken its argument, but as the RFC notes makes it easier in the future to figure out how widespread dynamic properties actually are in code today. Right now... we simply don't know. It's possible the impact here will be almost nil, or it could break anything written before 2010. (I'd guess it's closer to the former than the latter, but no one knows for certain.) Just grepping for the attribute in the future would give us a better picture of how common it is. To those that are arguing that the timeline is too aggressive, I would turn the question around: What timeline would be acceptable? "Well behaved" code hasn't used dynamic properties outside of a few very edge bits in a very, very long time, so transitioning to those being the exception and not the default is, IMO, reasonable. What would be a more comfortable timeline if not what is proposed here? (Bearing in mind the previous statements that treating deprecations as though they were warnings, even in production, is not Internals problem but a problem of people who have their servers misconfigured.) --Larry Garfield