Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105221 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 88784 invoked from network); 10 Apr 2019 23:36:49 -0000 Received: from unknown (HELO mail-lf1-f66.google.com) (209.85.167.66) by pb1.pair.com with SMTP; 10 Apr 2019 23:36:49 -0000 Received: by mail-lf1-f66.google.com with SMTP id h18so2814026lfj.11 for ; Wed, 10 Apr 2019 13:34:02 -0700 (PDT) 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=3kywoBQ9AoGc9q/EHxtElKiaWWwvc2JGsPhXcZg9s+E=; b=adgX9sGTuqjftCpAAp8L7MHuiXH2T9V7r2N51uA7iyeSOHNdGkYdjN5gzrd9Q8PnJd nMjFx66EDA8EgGu34zeY9gAKziblKwfTaTFHzLMzNjREvgTXBMM3Z9KFsapli/2d0Ne7 3Q7yhL/iJtn98ko5SuQYyXdTVgM6L6Ay2QCk/NcUsYUwborkj63KblENv3RL80KxH5JP zcfSiyHbaiAjbxHrPbwiaUO3jzljntCaAb6A35VNmCUdb6JWZE5V2GqhzlkB/GbbhOyU OLiLFsmG6GlhyIPHIYtnFW6ekQ3RXSyrCyPY7qnqjvaTEqT2DCMZBKvG/Km8yeLdaJJa wp8g== X-Gm-Message-State: APjAAAWu6CbFBPt1P33SaeMH2mmW67cSWGIplOTqT/jk9DhrXvttcjP3 XqHbVKerl+K8HPGbAv1ef2ituV1GHWGO6runn/k= X-Google-Smtp-Source: APXvYqyL9/nQ9kigpbpsbJhcFzMy3H3YYVLogtUTf0396iXiDrlrnKPfEc2bFxEe+NyXvmMSlBP4CdydSGxrTzT8CjQ= X-Received: by 2002:ac2:4214:: with SMTP id y20mr2888140lfh.75.1554928441677; Wed, 10 Apr 2019 13:34:01 -0700 (PDT) MIME-Version: 1.0 References: <010a5e8c-3614-6263-2553-b53b88be1273@gmail.com> In-Reply-To: <010a5e8c-3614-6263-2553-b53b88be1273@gmail.com> Date: Wed, 10 Apr 2019 14:33:44 -0600 Message-ID: To: Stanislav Malyshev Cc: Nikita Popov , PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] Deprecate left-associative ternary operator From: levim@php.net (Levi Morrison) On Wed, Apr 10, 2019 at 1:22 PM Stanislav Malyshev wrote: > > Hi! > > > Inspired by Bob's recent RFC for concat precedence, I'd like to propose a > > deprecation and removal of the left-associative behavior of ternaries. > > Instead, explicit parentheses should be used: > > > > https://wiki.php.net/rfc/ternary_associativity > > Please, let's not mess with language syntax and require people to > rewrite their code just because suddenly after 20 years of existence in > the language we feel maybe the precedence should be different. I > literally can't think of a single case where it would improve anyone's > life in any substantial way. If you wanted to use parentheses, you can > do it now - you can even have it enforced by code analyzer if you wish > so, in your private code base. But I can easily imagine dealing with > tons of deprecation warnings (which usually break CI unit tests and > wreak general havoc) or even worse, useless errors, in existing code, > which would become broken for no reason but... honestly, I don't even > know how to finish this phrase, I can't even think of a single reason I > could explain to anybody why their code would no longer work in 8.0. > > I understand 8.0 is a good target for breaking things. But that doesn't > mean we have to do it as much as possible. > > And this absolutely doesn't mean we need to get 7.4 to break things (and > yes, deprecation warning is breaking things, in most cases). > -- > Stas Malyshev > smalyshev@gmail.com > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php We do not consider new warnings, including deprecation notices, as breaking changes. We know that due to error handlers it can have an effect, but it's just part of the process. I disagree with Stas on the value. The precedence is wrong, and I know of a few codebases which had bugs due to this. In every case, the fix was to avoid it altogether. I agree with statement from the RFC: > As left-associative ternaries are almost certainly bugs, the impact of this change should be minimal. Thanks, Nikita, on putting this together. It's definitely not a "fun" RFC.