Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115307 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 98495 invoked from network); 5 Jul 2021 22:41:51 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 Jul 2021 22:41:51 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2B9941804B0 for ; Mon, 5 Jul 2021 16:03:26 -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=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE, URIBL_SBL,URIBL_SBL_A autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) (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, 5 Jul 2021 16:03:25 -0700 (PDT) Received: by mail-qv1-f43.google.com with SMTP id v17so8909462qvw.12 for ; Mon, 05 Jul 2021 16:03:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=SGVrs2rihX1xmJmnF/OWdkMdQiWjO4cvfZRgbaNidKo=; b=T0OAO3MIOMyamE8cRhI1fhACRLge5W81ZnouU9fegaxpNrWyhOD6nfqaTvDmNLQDPe 5BfGOLx8RGrHcjLXOTtKjreoQVeyOTfDZH5zeUx2t858b+FLQUINgxsIuWvgalRHHutY DRMoiiErlsc15PHUHnruevLDMN5ZqmyOSwiePY09c9ZY24dL0wIg4tIlkJ5p441h9U75 xhpJGiEA2nuSghVb1zzBFof17Pz36GM9a6xD995+ztDumcFEmTAJfp/fDSw5p424Ciwz rczI9+48vvXVn8gQRfnHW7CZc9t99l2+gNCrrQjTdikQ21fdqf7dNh0iuRQX1tPJJxFd DRxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=SGVrs2rihX1xmJmnF/OWdkMdQiWjO4cvfZRgbaNidKo=; b=kBBNURx8wLbje0+w9EvdQufdfjADVqJuXLSYDK2srmxu2qgDamhfFRfHcdSd/L4DJl LxCj2FolEwAXwxl2Dg5476Kr5PImNNA1tan9k5DKYyRfjc1p0INF8Z89k/h592tYp4OJ ncdCJZ7LY75jH5bkJHI3l3r+r/8LiQZIgsX7vMLOAqlKZFxUclxQjh0TkPPlVaAjBMwd uRAUXgh4yZpAJQyk4nBdci50Wr3sYkqwBrLrhM4G+R+yAFewR71h3U3q6dXT32V06i5R /ffBiO5SrIvgnBRLD3a4dilfhcrEQmmZR70sghCj1leXebaDyAq3e6oHMJJayjvE/k1w d/Og== X-Gm-Message-State: AOAM532XvSMwPrV6Pf2mi2bemuj0o5hu5Rpz/UpZTZ/rBoZAIp+q+JAt +7OqW44XACd1aFPh3vmKNGMhGQ== X-Google-Smtp-Source: ABdhPJwK7FmPc1f8NdJRFVFmt2Y/51hyutcIh8JaiYleOyZWdEn7nSZewvUT7e1OtzB/OCZftDDXfg== X-Received: by 2002:ad4:4521:: with SMTP id l1mr6151126qvu.20.1625526203750; Mon, 05 Jul 2021 16:03:23 -0700 (PDT) Received: from [192.168.1.10] (c-24-98-254-8.hsd1.ga.comcast.net. [24.98.254.8]) by smtp.gmail.com with ESMTPSA id n64sm5960194qkd.79.2021.07.05.16.03.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Jul 2021 16:03:23 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) In-Reply-To: <62eb8eff-e671-5b3b-5e25-2a5b38160fcd@gmail.com> Date: Mon, 5 Jul 2021 19:03:21 -0400 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: References: <1dcefcec-a3e4-e773-4950-b11d377ecc7f@gmail.com> <122F660D-DE94-4DFE-A0E9-FEC202E89E3A@newclarity.net> <62eb8eff-e671-5b3b-5e25-2a5b38160fcd@gmail.com> To: Rowan Tommins , "G. P. B." , Guilliam Xavier X-Mailer: Apple Mail (2.3608.120.23.2.7) Subject: Re: [PHP-DEV] [VOTE] Deprecations for PHP 8.1 From: mike@newclarity.net (Mike Schinkel) Replying in one long email to all three who replied to me: > On Jul 5, 2021, at 8:03 AM, Guilliam Xavier = wrote: > Hi Mike, >=20 > Your links speak *in general*. However this is *specifically for PHP*: = https://www.php.net/manual/en/errorfunc.constants.php#errorfunc.constants.= errorlevels.e-deprecated-error (*emphasis* mine) >=20 > E_DEPRECATED: Run-time notices. Enable this to receive warnings = about code that *will not work in future versions*. 1. In general (no pun intended), is it a good idea for PHP to take a = general concept and redefine its meaning? (Rhetorical question.) 2. That link you provided speaks of not working in future versions. = That future version could be 5 major versions from now, doesn't have to = be next version. 3. And most importantly, the content on that page is not written in = immutable stone. It could just as easily be updated to say the = following, assuming that an agreement is made to do so:=20 "Enable this to receive warnings about code constructs that are = discouraged and MAY not work in future versions, so best for developers = to no longer depend on it." > As for "significant BC breakage", isn't that what major versions are = for? (and with the current release plan, 9.0 would be for end 2025, i.e. = 4 years after 8.1) They can be, but AFAIK there is no immutable principle in software that = deprecated versions must be removed in the next major version. Doing so = or not doing is simply a choice, a decision about what is in the best = interest of the software and its user base. And unless I misunderstand, = nothing about the PHP project is immutable that cannot be changed by = consensus and/or an RFC vote.=20 So I am simply making the argument that this restrictive idea that = deprecations *must* result in removal in the next major version can do = more harm than good in selected cases. =20 Being restrictive in our view of deprecation means we create BC-breaked = changes when we really don't have to, and more importantly it means we = do not signal that certain practices are to be discouraged when we = could. Imagine if we decided to deprecated global variables and instead = encourage DI and/or static variables in classes? IF we could deprecate = global without removal, I would be 100% for deprecating global. But = given the current restrictive interpretation promoted by some, we should = all be 0% for deprecating global. > On Jul 5, 2021, at 8:05 AM, G. P. B. wrote: >=20 > For the PHP project deprecation means a future removal, I'm pretty = sure this is an agreed policy for the project. Can you point me to where this has been definitely agreed in the past? = An RFC ideally? (Honest question.) There is this[1] but it only says functions will usually be completely = removed "Later" and not "next major version." "Later" could be 5 = versions later. There is this[2], but it makes no mention of when, nor was it ever voted = on. [1] https://wiki.php.net/rfc/deprecated-modifier [2] https://wiki.php.net/rfc/deprecated_attribute > E_STRICT was like Rowan said used for cases of "well you should = probably not do this but we'll accept it", > and this category has been removed. But the E_STRICT constant was not removed. (Ironically?) The motivation was "to simplify our error model and resolve the = currently unclear role of strict standards notices." So as I read it[3] = we are talking apples (policy) and oranges (simplify error model/improve = clarity) [3] https://wiki.php.net/rfc/reclassify_e_strict > Now if you truly want this definition of "deprecation" can I bring = forward again to "deprecate" short tags, using 'var' for object = properties, all of the SPL data structures, a bunch of extensions, using = locales, and maybe to be fancy emit one when you don't use a visibility = modifier on object methods/properties/constants, heck why not even one = for not using a typed property now that we got mixed and union types. I would be 1000% for ALL of those. Bring them on, PLEASE. But since you wrote that I assume you think that would be a bad idea. = Why? > As you can see this opens the door to kinda everything being marked as = deprecated just to ensure another discussion needs to be held for a = removal. Yes, it opens the door for doing a lot of good for PHP, IMO. > The policy of X being deprecated means it's going to be removed is = very clear for end users who don't need to scramble as to whether or not = this deprecation leads to a removal or not. In all my years working with other developers, I have never witnessed = anyone "scramble" to determine if deprecation means removal. Deprecation = has a pretty clear meaning to most developers I know. It simply means = "not recommended." If a developer uses a deprecated feature, they are = "doing it wrong." BUT, the project owner who has existing code isn't doing it wrong to = want to continue to run their software without having to invest new = money into refactoring because of a function removal. Unless there is a = compelling reason such as security concern they should not have to spend = that developer money just to use the latest version of PHP. =20 OTOH developers would benefit from being signaled to stop using = practices when there is a consensus they practices are not good even if = the "bad" functionally cannot be removed in the near future. > On Jul 5, 2021, at 8:16 AM, Rowan Tommins = wrote: > To be clear, I don't think contrasting "accepted definition" against = "my preference" is quite right here; there are plenty of places that = document the definition I am familiar with, e.g. Let me clarify. When I said "your preference" I was not trying to target = you, I was using "your" collectively to convey the preferences of all = who prefer that interpretation.=20 And my assumption is the people who wrote the following also had a = preference for the same interpretation. But since you bring them up: > * Foldoc (taken from the Jargon File): http://foldoc.org/deprecated "Deprecated features can, unfortunately, linger on for many years." =20 (Note it does not say deprecation means "must be removed in next major = version.") > * Wiktionary: https://en.wiktionary.org/wiki/deprecated "Said of a function or feature planned to be phased out, but still = available for use." =20 (Note it says plans do be phased out but "still available," and does not = establish any time metric for removal.") > Removal is also specifically mentioned in official documentation for = plenty of PHP projects, e.g. > * The description of the "@deprecated" tag in PhpDocumentor : = https://docs.phpdoc.org/3.0/guide/references/phpdoc/tags/deprecated.html "The @deprecated tag declares that the associated Structural Element(s) = will be removed in a future version" (Note it does not specify *which* future version. As written, it could = mean 5 majors versions from now.) > * The Drupal Core deprecation policy: = https://www.drupal.org/about/core/policies/core-change-policies/drupal-cor= e-deprecation-policy "When a new API is added, the old API will be deprecated... it will = usually be removed in the next major version." (Note it says "usually," not "must" which implies that at times there = are good reasons *not* to remove.) > * The general migration guide for Symfony : = https://symfony.com/doc/current/setup/upgrade_major.html#make-your-code-de= precation-free "When the major version is released (e.g. 5.0.0), all deprecated = features and functionality are removed." (This is the only one that matches your interpretation. Which is not = surprising as Symfony itself is the most draconian of well-known PHP = frameworks. Should PHP really be as draconian as its most draconian = framework?) > More directly relevant, the PHP manual at = https://www.php.net/manual/en/errorfunc.constants.php currently = describes E_DEPRECATED as: > > Run-time notices. Enable this to receive warnings about code that = will not work in future versions. As I said above, which future version? It does not state "the next = major version." =20 Besides, as I also said above, this could easily be clarified to provide = an option assuming we developed a consensus on the topic. > Obviously, that could be changed to also include "features that are = strongly discouraged but not currently planned for removal", but I'm = still not convinced that that would be a useful change. I am not advocating that. I am advocating we should consider making it:=20= "features that are strongly discouraged will *probably* be removed in = the next major version, but in some cases may be retained for one or = more major versions." > If we can create and document a good alternative for strftime(), then = why *not* mark it for future removal. And if we can't provide that = alternative, what use is there in notices discouraging it? I have no opinion pro or con on whether or not strftime() should be = removed because I don't often use it so I don't have any idea how many = BC breaks that it will entail.=20 Instead I replied because your email strongly implied (stated?) that = "deprecation required removal" and I think that position is ultimately = harmful to the language evolution because it keeps of from deprecating = things that we should discourage but that are too widely used to remove. -Mike P.S. I am not going to propose we have an RFC to establish a policy = here, but if someone with experience knowing what is and is not = appropriate for RFCs proposed I would definitely be happy to see the = question getting resolved, pro OR con. =20 P.P.S. And if it was an RFC I think the vote would need to be 51% vs. = 2/3rd because it is a binary decision to clarify a policy, not a change = to existing code. There is no definitive precedent to change that was = ever voted on (unless I am wrong and there was an RFC on this topic?)