Re: Re: [RFC] Deprecate left-associative ternary operator

From: Date: Wed, 24 Apr 2019 09:10:53 +0000
Subject: Re: Re: [RFC] Deprecate left-associative ternary operator
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-105366@lists.php.net to get a copy of this message
Den 2019-04-22 kl. 10:09, skrev Nikita Popov:
On Tue, Apr 9, 2019 at 11:54 AM Nikita Popov <nikita.ppv@gmail.com> wrote:
Hi internals, The only objection here came from Gabriel, and I don't think we'll come to an agreement. 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_The only objection here came from Gabriel, and I don't think we'll come to an agreement.associativity <https://wiki.php.net/rfc/ternary_associativity> This RFC makes nested ternaries without disambiguating parentheses an error in PHP 8 -- we might want to consider making them right-associative instead, which is both useful and matches the behavior of other languages. Regards, Nikita
Heads up: Plan to start voting tomorrow. Apart from Bishop, would anyone else prefer to directly go to right associativity in PHP 8 rather than making it an error? I'm rather partial to that myself, maybe it can be included as a voting option... Nikita
Hi, I think one should go for the right associativity. 8.x is the right place to do it, if at all. Doing it directly in 8.0 has the benefit that when upgrading to a major version it justifies an upgrading project for an application and one also might get tool support, e.g. the php7mar tool for 7.0 was quite valuable. Also IDEs like phpstorm has good support. One then has to weigh legacy code versus new code being written with a behaviour different from almost all other languages. I'm not sure if this is an appropriate example to compare with, but I came to think on the PHP 7.0 Uniform Variable Syntax rfc regarding migration effort and BC impact. r//Björn L

« previous php.internals (#105366) next »