Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106800 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 15568 invoked from network); 29 Aug 2019 18:18:44 -0000 Received: from unknown (HELO mail-ua1-f67.google.com) (209.85.222.67) by pb1.pair.com with SMTP; 29 Aug 2019 18:18:44 -0000 Received: by mail-ua1-f67.google.com with SMTP id g13so1316827uap.5 for ; Thu, 29 Aug 2019 08:51:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/ajCN7+EUzLlt2OcmYKJormN05mktV6oJSAbspNshD4=; b=j6g6p3CY2ccge7urvzqCEktvIXcWGUfyFLokpryhKZ+kP654ofoGeueqFFWaLC6Vot IJa++3Ldudq4iq46U2GtMFrCzs/QF+y/Aj+gXS/3Flmpa/Uy949Uwh6V/quyuCtQ+LQx jW5col+B6UFHwP9aj52PQs8e8u4xQ1XmTZQfavx7MKVlq8Ay6r7THMovWtIqcog3Ye93 0/u9d7X2rDIfkbkxpyPqz/kEXougBsaoHX4EFbq8x7TD3po9ZviV3DUDq3maZFn1iUxt GvjtIVqkZTjWK7+ledFehVMNsbN/fSoFUzNd32+xYYkSwbA36S3oI89BbTr2yKN4nA9i NqDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/ajCN7+EUzLlt2OcmYKJormN05mktV6oJSAbspNshD4=; b=U9C3Z8YWPx/Npy07Av0uCWoleRGdVqRZsESf6NAJ6nNlhxG6oAg039tt0zcHJY/5c9 d9E84obcWcCw0dLC0ecThX5vVEOVdsyZbv9WMJLEGhZD62I0WVLbyezQTy8s2LT76bjS A8fQgRW7vYcB3WNGkwO9Uhc0sPkg38OQebYxkLyxepD20veBUvLtmSYCt4RV1J0UmEi4 tBj1b/pZjN17DkoBY38qa0I6u5u2Cw41KCSenPZP5MdDc9GckK0FeWQUeq7DjSt0xgXn 46IQOAvyQs3YkNHMLGmq1NR+M+8u8yfZv6fn1MpVsdX2JljBwKSJDjXd6baAtgbk2VCz Eh3g== X-Gm-Message-State: APjAAAWP1vdxRS4U3WYxdx9tBQdE8awS+UuE5xiA6HyNCjCwsAIXKgXj XKOtX3jhVjbDqVfYlzMrhQT4xAge3joDeUdKJNgGvdWl X-Google-Smtp-Source: APXvYqycOw4dOb3/qEME0n6sDldAoo35FHRwjwmyGvVU65qC9aMHzIwn400+VMFJKgqPSRz34rsVStbM0xMt6pBC0Iw= X-Received: by 2002:ab0:3359:: with SMTP id h25mr5139267uap.132.1567093869727; Thu, 29 Aug 2019 08:51:09 -0700 (PDT) MIME-Version: 1.0 References: <33b4068a-3b32-4904-a033-4ff3f28e1161@aegir.sexy> <1EDD1FE6-9AB8-4CDF-8EE4-416C18390725@gmail.com> In-Reply-To: Date: Thu, 29 Aug 2019 11:50:57 -0400 Message-ID: To: Zeev Suraski Cc: Aegir Leet , PHP internals Content-Type: multipart/alternative; boundary="0000000000006f53e405914379ae" Subject: Re: [PHP-DEV] [RFC] Reclassifying engine warnings From: chasepeeler@gmail.com (Chase Peeler) --0000000000006f53e405914379ae Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Aug 29, 2019 at 10:22 AM Zeev Suraski wrote: > On Thu, Aug 29, 2019 at 4:02 PM Aegir Leet via internals < > internals@lists.php.net> wrote: > > > 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, unforesee= n > > circumstances, your code could generate a notice here, probably because > of > > something that is outside of your control". > > > > That's how I've always treated them at least. > > > > 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. > > 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. > > 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 somethi= ng > > everyone would naturally want to avoid. You don't drive your car with t= he > > check engine light permanently on and say "this is fine", right? > > > 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. > > Zeev > 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 back in flexibility. 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 important 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 for 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. 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.) as 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 to declare variables. So, while c# might require "int i; i++;" you can achieve the same thing in PHP with "$i++;" - neither one requires an explicit initialization. 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 considered when weighing the pros and cons of a breaking change. That being said, I do 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. * 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 Chase Peeler chasepeeler@gmail.com --0000000000006f53e405914379ae--