Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105389 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 51471 invoked from network); 24 Apr 2019 19:27:04 -0000 Received: from unknown (HELO mail-it1-f169.google.com) (209.85.166.169) by pb1.pair.com with SMTP; 24 Apr 2019 19:27:04 -0000 Received: by mail-it1-f169.google.com with SMTP id s3so7433460itk.1 for ; Wed, 24 Apr 2019 09:27:45 -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; bh=ba9A6u5l7vcd5flDEjvKQi5/T5+V2BMWHxalJRGQFR4=; b=TsFerQEUTXyP7X29yVNc+wVD4I3wxNqGt0nLm1K2LXNmio8aOapI+aqQpcbV2FBEBB 5KLteD1C4KXjWOlT8aId2+LlhVyLnRugwYYGInCWd/Cc4rIkgxgrGUdoJS5aaTdKnfNz yBaHw6htjiqOWSGVR2OVAh0DcfiNQ0WP1Kq6cARdulmDh0h5YlHsz6LY7XSq5eH4b8gp ybGoQn6BZdTFyfHcpUhCxHLOWKM+US64LerIXcE8p6f00wqTKFF/bXDLT9EoiB0OyP5T Hl4VTqBC+mtqIqB2WfmbmVo5gyre1/v7n/A8Q9K+LGfwqYDTNtubMdis9j7/sfrX/c97 GEhQ== 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; bh=ba9A6u5l7vcd5flDEjvKQi5/T5+V2BMWHxalJRGQFR4=; b=hw+GLnOOkw130d/Rjpnd/0976z51WFWiAgByYU8qiBdT6u+lhMBaCrHn9/+IH+2Z/h lCHklWS1nztMqML6KJewECl5GJGQYf9+sh9U4QDpyut1pXch7EX0MYcwYNU22BwPKaIN 9j/suasbsZ6zqFg6FhvHiFrHtVJ1RZlOSDXoKUQwaltFbwIIgGdI2upNmfSNnQKRP+31 br/ZKhWUsroi4+uoTdkPh3oTGdUoZxokiXsQycuH1xfedzzqNP1iT+V1txxY+tPafj86 onQb5Zplv8qTvs6U7lHtRj6HmTlb6E5zb0a4sYHXPwI9/NopH8ALXPEUHxeWFZvHSrzp Mo0A== X-Gm-Message-State: APjAAAWD5WMgDxjgUs1htqn0RP9oLa/jFXYeT9cnyQn/dumHUM4E7/oH 3I1slzVWGDW+kh4TRyPBRpxB8jv8EEzrWp3UxB+qq9cwLuw= X-Google-Smtp-Source: APXvYqyRFR54XhNUoPKd48KegYpvPr2GSjENTHfWeS4oq/hpaFXk4pi4W4MlqVLKmryNbiKQktnmK+o0inoaY+PPNkM= X-Received: by 2002:a24:438e:: with SMTP id s136mr7588016itb.110.1556123264441; Wed, 24 Apr 2019 09:27:44 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 24 Apr 2019 18:27:27 +0200 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="00000000000067616c0587492e54" Subject: Re: [VOTE] Deprecate left-associative ternary From: nikita.ppv@gmail.com (Nikita Popov) --00000000000067616c0587492e54 Content-Type: text/plain; charset="UTF-8" On Tue, Apr 23, 2019 at 10:43 AM Nikita Popov wrote: > Hi internals, > > I've opened voting on the RFC to deprecate & remove left associative > ternary without explicit parentheses. The vote ends 2019-05-07: > > https://wiki.php.net/rfc/ternary_associativity > > The RFC stays as originally proposed: The associativity of the ternary > will *not* be changed to right-associative in PHP 8, only the > left-associative use without disambiguating parentheses becomes an error. > > Regards, > Nikita > To better judge the BC impact here, I've analyzed the top 1000 composer packages for this pattern. The results are here: https://gist.github.com/nikic/b6214f87b0e4a7c6fe26919ac849194f The tl;dr is that nested ternaries were used a total of 12 times across all files. 9 of these uses are bugs: A right-associative meaning was intended, but PHP will interpret left-associatively. 3 uses of the form $a ? $b : $c ?: $d are potentially okay, because the difference between the two interpretations is small and it's not obvious to me which one is actually intended. Nikita --00000000000067616c0587492e54--