Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106801 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 20164 invoked from network); 29 Aug 2019 18:41:01 -0000 Received: from unknown (HELO mail-qt1-f193.google.com) (209.85.160.193) by pb1.pair.com with SMTP; 29 Aug 2019 18:41:01 -0000 Received: by mail-qt1-f193.google.com with SMTP id b2so799365qtq.5 for ; Thu, 29 Aug 2019 09:13:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=qqbO5+KNU4RNENj+yerCcP8KBygedqKCpYifEdauwbI=; b=NYKwYd/vcFOet2rTFqtRa7Zq+cBB3mdPo5BEwN1ICk4bynx8F0c6koPB9gK1R/By8E rjoXSGR0UJk1XREkQmmwGfCt2QV/K1fg/aCObBJRWqOlDZti6FvApV7ky7gCrWOi7jbW D34yJm54MMVF50kAko44k++83eHkslsnDUi8q0RyySgsbOxbxc9x6DDAyg/d/cp+XSnl z649iyDt9I3PHl+9KAvNsd5db8J2YUlNmje3xW3vOjGcKdGrpOSK/Gim75ZmeZrXqMsL bXDIqg6p+K04EYxWb6vtjK9ZFu38NEc+xm019gBVDFRSxaHTRyS8Ch0zSos7y6LkEw2p fbFQ== 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=qqbO5+KNU4RNENj+yerCcP8KBygedqKCpYifEdauwbI=; b=jcTUblIS2nwKVM8x2J1cnW+xa5/Aij5x90VLXjE3T42jLB3geMBTd+QQjxk4Koe2g+ 09xr5NR8r8tQI6E2WUcSf2Vn6efpIpwyM2OeUB6PyPN/zAJA5ONSQJSaqP2XHVfodvpi 3322e5sqeoksLxWzMQOxsuA2FRTwbytjhNWKM3ocU0AB7Zvt4Ujulg7EdRVtgqXf6fcu qfjpLHz52NWV6TGyhjpgkZAjdRov8NfofOzzqEvwRawO2TmWL947cNa3na9603xTMbMq Kq0SF7qrBBOeaX2ngc+tih6Fbxh16R/fY/JOHuo+f3mLK55n6g5VDL0WhLECudRGfi2k UOMg== X-Gm-Message-State: APjAAAXXOtCN+8QhcrcjADImmOL1uwEnmHr5Ujj0QPoag1IYJbKBOWzC rFfp17MY+gVb6J6JPW6CbBg= X-Google-Smtp-Source: APXvYqzdBP/2oZn59MDs0VlxhqaKcUSEXoQ4FMELRkNMlGu9qLz+VCAR6OsYl+dYx5/fAmwFmRISug== X-Received: by 2002:a05:6214:110c:: with SMTP id e12mr6930394qvs.126.1567095207107; Thu, 29 Aug 2019 09:13:27 -0700 (PDT) Received: from [192.168.177.42] ([8.40.92.161]) by smtp.gmail.com with ESMTPSA id d23sm1425562qkc.127.2019.08.29.09.13.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Aug 2019 09:13:25 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) X-Mailer: iPhone Mail (16G77) In-Reply-To: Date: Thu, 29 Aug 2019 12:13:24 -0400 Cc: Zeev Suraski , Aegir Leet , PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <33b4068a-3b32-4904-a033-4ff3f28e1161@aegir.sexy> <1EDD1FE6-9AB8-4CDF-8EE4-416C18390725@gmail.com> To: Chase Peeler Subject: Re: [PHP-DEV] [RFC] Reclassifying engine warnings From: matthewmatthew@gmail.com (Matthew Brown) I don=E2=80=99t think it=E2=80=99s helpful to compare C#=E2=80=99s BC polici= es to PHP=E2=80=99s. C# is used today mostly as its architect intended at it= s founding. PHP, having transitioned from a templating system to a fully-fle= dged language, is used quite differently. > On Aug 29, 2019, at 11:50 AM, Chase Peeler wrote: >=20 >> On Thu, Aug 29, 2019 at 10:22 AM Zeev Suraski wrote: >>=20 >> On Thu, Aug 29, 2019 at 4:02 PM Aegir Leet via internals < >> internals@lists.php.net> wrote: >>=20 >>> I know what the manual says about notices. But I don't agree with >>> interpreting "could happen in the normal course of running a script" as >>> "it's perfectly fine if this part of your code triggers a notice >>> consistently and every time it goes down this particular code path". >>> Rather, I've always interpreted this as "under certain, rare, unforeseen= >>> circumstances, your code could generate a notice here, probably because >> of >>> something that is outside of your control". >>>=20 >>> That's how I've always treated them at least. >>>=20 >>=20 >> And that's entirely within your right to do so - but what the manual says= >> is accurate. Calling me delusional in my interpretation of it is somewha= t >> awkward (to put it mildly), I have a pretty good idea of why we added the= >> different error levels - I wrote much of it myself. >>=20 >> The whole point of having notices as something that's separate from >> warnings is that they have different semantics, and that semantics is >> captured very accurately in the manual. They are used to mark issues whi= ch >> may be problems, but may also be perfectly fine (unlike warnings, which >> generally speaking mean that something bad happened, but not bad enough t= o >> halt execution). Notices were meant to help you implement a more strict >> style of coding, and they may help you catch certain types of bugs, but y= ou >> can have perfectly working, bug-free code that generates notices. >>=20 >> Regardless of the exact semantics, don't you think a program that generat= es >>> a constant stream of notices is a bit strange? That sounds like somethin= g >>> everyone would naturally want to avoid. You don't drive your car with th= e >>> check engine light permanently on and say "this is fine", right? >>=20 >>=20 >> Except you can purposely turn off this 'check engine' light, never to see= >> it again if you choose to. And that it's really not at all similar to >> 'check engine', but a lot closer to 'check cleaning fluid', or even 'clea= n >> windshield' (if cars had a dashboard light for that). Even that is not a= >> good analogy - as folks often actually purposely write code that generate= s >> notices (which would be purposely hidden, either by error_reporting setti= ng >> or using @) that is 100% bug-free and working as intended. So no, there'= s >> nothing strange about it if you buy into that approach. If you don't (an= d >> I know you don't) - that's absolutely fine - it's up to you. >>=20 >> Zeev >>=20 > I just wanted to bring up a few other points. First, as I think Stanislav > has done a good job of pointing out, the flexibility of PHP is one of its > greatest features. The nice thing about a flexible and forgiving language > is that you can always put additional things in place on top of it to make= > it more strict and rigid if you want. Once you force a language to be > strict and rigid, however, it's much harder, if not impossible, to add bac= k > in flexibility. >=20 > A lot of my emails on this thread have been focused on the burden to > developers caused by the BC break. While I still think that is an importan= t > consideration, it distracted me from my initial view which was we shouldn'= t > do this because it's just a bad idea. I understand all of the arguments fo= r > enforcing variable initialization. I agree with most of them as well. > However, I think there are a myriad of ways that individuals and teams can= > do that enforcement without forcing it on every single developer whether > they want it or not. >=20 > A lot of comparisons have been made to other languages. I do a lot of work= > with javascript and I have a good amount of experience with c# as well. > I've used many other languages at times (c, c++, java, perl, ruby, etc.) a= s > well. In c#, you don't have to initialize your variables - you have to > declare them. Some types, like ints, are automatically initialized to 0 > unless explicitly initialized to something else. PHP doesn't require you t= o > declare variables. So, while c# might require "int i; i++;" you can achiev= e > the same thing in PHP with "$i++;" - neither one requires an explicit > initialization. >=20 > A few people have referred to the fact that I have instances of undeclared= > variables as technical debt. As I said earlier, I've engaged in these > discussions because I don't think just calling something technical debt > should be justification for a change. The fact that a large number of > developers might have technical debt in a certain area should be considere= d > when weighing the pros and cons of a breaking change. That being said, I d= o > NOT consider such code to be technical debt or bad code that needs to be > fixed. The only way it becomes either of those if with the implementation > of this RFC. It's a bit disingenuous to tell developers they have to make > large changes, and when they push back, tell them it's their fault for > accruing so much technical debt - when it's the RFC itself that actually > causes the technical debt to begin with! *I will no longer engage in > conversations on this topic that relate to how you think my company should= > conduct business or prioritize development. * >=20 > Finally, since people seem hell bent on turning PHP into a language that > operates like all the others, instead of letting it keep its unique > qualities that make it great and different, I asked a c# developer I know > about how Microsoft deals with breaking changes. Here was his response: > "I=E2=80=99ve never heard of a breaking change when new versions of C# are= > released. There are occasionally breaking changes when upgrading to a new > version of .NET, but they always (as far as I=E2=80=99m aware) have a way t= o > prevent the change from breaking anything by adding a parameter the app=E2= =80=99s > configuration." >=20 > --=20 > Chase Peeler > chasepeeler@gmail.com