Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116371 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 81194 invoked from network); 15 Nov 2021 12:41:06 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Nov 2021 12:41:06 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 280D218053E for ; Mon, 15 Nov 2021 05:35:48 -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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE 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-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 ; Mon, 15 Nov 2021 05:35:47 -0800 (PST) Received: by mail-wr1-f51.google.com with SMTP id i5so30793243wrb.2 for ; Mon, 15 Nov 2021 05:35:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beberlei-de.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=a93Q3RYqRdd1OLc28u9KONKGXspb5u+uuKKiCGb4SIA=; b=RGlIft3XRDbJxconDX813i7WnA/JkJiWEW6SO8XZYFefreBAsQqVhfoVNDNDj6SS4i utmYbaZTt9sugu4tmBAhyGVGflnEROIYiuqtwWMcMIAvDvBf7OJSDr9LwjQvde37Nnts GcB4r6p3IbLVf+05txMMTWyrRXRkTWloXFu/BYjQsgFjxaesp6aHXiLqtmtVrBrEV7tj 9fnsbCXm2acomP0t/UxfpoEx8vLoTLcAs4HyKeQT0vPBO75aPupl9I96j8i1hB2lQM4x n5WJASiD+UC5EkjGO0VrF3NL7w0B310kBpM2jCXXlPR2PgM2o7IzqI/gnYi+lQAK3qtQ BQCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=a93Q3RYqRdd1OLc28u9KONKGXspb5u+uuKKiCGb4SIA=; b=ZZhngTYBDHb2UJoP2VLMh7UGGj3ct70SgISYuxN4vzo/qC9XPAgAn0dkYpuoJwxODG +tVamZS2sI5pj4dm+6S2n58orQIkFmDXCHuo2J2QQdOkVhMOXguOCcE5E+bDMRa7QAIO taMIFG1AeXqNrg7dTtRr/w7wb6oIQ5Vz+atacUXksFYrALqppiFFJbCN7ixl6Xk5yHMT IaKKKsd44iKFZ+Xmfz63HiT3Hv+DnmNz/b5C/KHhX8TMGxr+P6ye4lQiayKlVHnomO9w nhKU7tVsQfmaYVWqfV5oXO9w4tg3n3RgHHSAJHLGrQrdN/Meye2DNfmxdi8L+Pb9ML12 uelA== X-Gm-Message-State: AOAM532Qrj/0RceonFU6RwNDHZv8ZE5mDlTLI8IGg2qTfHMksxdlHFcw Phbuz7k178mj4C5tZYkbdMUI6Ai9fC0vGQ9UjeZc6uD2WiM= X-Google-Smtp-Source: ABdhPJyD0MUmGxWQoTVHJOLFfg8r1iDlDjiBavvi5J5gUrjvkZTDgHjr9lPZthVdFs3lHbLP/a2JeT0E+NHvtCdaM5g= X-Received: by 2002:a5d:4443:: with SMTP id x3mr48334057wrr.189.1636983346443; Mon, 15 Nov 2021 05:35:46 -0800 (PST) MIME-Version: 1.0 References: <371ca983-2b07-ae39-3629-49cf7ff8ee64@heigl.org> In-Reply-To: <371ca983-2b07-ae39-3629-49cf7ff8ee64@heigl.org> Date: Mon, 15 Nov 2021 14:35:35 +0100 Message-ID: To: Andreas Heigl Cc: PHP Internals Content-Type: multipart/alternative; boundary="000000000000de4b5205d0d3e292" Subject: Re: [PHP-DEV] Re: [RFC] Deprecate dynamic properties From: kontakt@beberlei.de (Benjamin Eberlei) --000000000000de4b5205d0d3e292 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Nov 15, 2021 at 1:52 PM Andreas Heigl wrote: > Hea all. > > On 15.11.21 10:52, Derick Rethans wrote: > > Dear Internals, > > > > On Wed, 10 Nov 2021, Nikita Popov wrote: > > > >> On Wed, Aug 25, 2021 at 12:02 PM Nikita Popov > wrote: > >> > >>> This RFC takes the more direct route of deprecating this > >>> functionality entirely. I expect that this will have relatively > >>> little impact on modern code (e.g. in Symfony I could fix the vast > >>> majority of deprecation warnings with a three-line diff), but may > >>> have a big impact on legacy code that doesn't declare properties at > >>> all. > >>> > >> > >> I plan to open voting on this RFC soon. Most of the feedback was > >> positive, apart from the initial choice of opt-int mechanism, and that > >> part should be addressed by the switch to the > >> #[AllowDynamicProperties] attribute. > > > > The voting is now open, but I think one thing was not taken into accoun= t > > here, the many small changes that push work to maintainers of Open > > Source library and CI related tools. > > > > In the last few years, the release cadence of PHP has increased, which > > is great for new features. It however has not been helpful to introduce > > many small deprecations and BC breaks in every single release. > > > > This invariably is making maintainers of Open Source anxious, and > > frustrated as so much work is need to keep things up to date. I know > > they are *deprecations*, and applications can turn these off, but that'= s > > not the case for maintainers of libraries. > > > > Before we introduce many more of this into PHP 8.2, I think it would be > > wise to figure out a way how to: > > > > - improve the langauge with new features > > - keep maintenance cost for open source library and CI tools much lower > > - come up with a set of guidelines for when it is necessary to introduc= e > > BC breaks and deprecations. > > > > I am all for improving the language and making it more feature rich, bu= t > > we have not spend enough time considering the impacts to the full > > ecosystem. > > > > I have therefore voted "no" on this RFC, and I hope you will too. > > > > cheers, > > Derick > > After some thoughs on this RFC I have reverted my original vote and > voted "No" due to several reasons. > > For one thing it is not clear to me what the benefits are. Yes: The > language evolution RFC talks about "Forbidding dynamic object > properties" but it also specifies that "there is also a lot of old code > that does not declare properties, so this needs to be opt-in"[1]. > > And as far as I can see from the PR associated with this RFC it will not > make life easier for the internals team. It is not like there will be > hundreds of lines code less to maintain. On the contrary. There is more > code and more logic to maintain [2]. > This RFCs goal is not to have less code to maintain, but to fix a nasty class of errors in user errors where they accidently write/read to a dynamic property due to a typo, instead of accessing the declared one. True this is a mistake of the RFC not to highlight more. > So when the only reason for the change is that one line in the RFC ("In > modern code, this is rarely done intentionally"[3]) then that is not > enough of a reasoning for me for such a code change that requires a lot > of existing code to change. > > Those that want a cleaner code can already use static code analysis to > find such issues (if not, I'm sure that there will be some analyzers > around before PHP8.2 will be around) or write appropriate tests to make > sure that they do not use undeclared properties. > Code that intentionally or unintentionally uses dynamic properties often does not write each propery explicitly: $object->$columnName =3D $value; This cannot be detected by static analysers. For the case where you explitly write a property name, While static analysis and IDEs do help detecing these as problems, this class of bugs happens because you are *not* using an IDE but a text editor like Vim/Notepad++ where you maybe add a typo to a property name while writing code. > While I personally would really like to deprecate dynamic properties I > believe that it is the wrong thing to do for the language. At least > given the presented arguments why we should do it. > > Cheers > > Andreas > > PS: Am I the only one missing whether this is a 2/3 or a 50%+1 vote in > the RFC? > > > > [1] > > https://github.com/nikic/php-rfcs/blob/language-evolution/rfcs/0000-langu= age-evolution.md#forbidding-dynamic-object-properties > [2] https://github.com/php/php-src/pull/7571/files > [3] https://wiki.php.net/rfc/deprecate_dynamic_properties > > -- > ,,, > (o o) > +---------------------------------------------------------ooO-(_)-Ooo-+ > | Andreas Heigl | > | mailto:andreas@heigl.org N 50=C2=B022'59.5" E 08=C2=B0= 23'58" | > | https://andreas.heigl.org | > +---------------------------------------------------------------------+ > | https://hei.gl/appointmentwithandreas | > +---------------------------------------------------------------------+ > --000000000000de4b5205d0d3e292--