> Le 24 avr. 2019 à 11:10, Björn Larsson <bjorn.x.lars...@telia.com> a écrit :
>
> Den 2019-04-22 kl. 10:09, skrev Nikita Popov:
>> On Tue, Apr 9, 2019 at 11:54 AM Nikita Popov <nikita....@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
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
If you go for right-associative straight in PHP 8, you make it mandatory to use
a static analysis tool for:
* migrating code from one major version to the next;
* maintaining a library that aims to run in two major consecutive versions.
Although that might be a no-brainer for anyone following internals, I doubt it
is the case for anyone writing PHP.
With a more step-wise approach (left-associative in PHP 7, non-associative in
PHP 8, right-associative in PHP 9 or 10), the situation is much safer and
simpler: you can’t even compile the code in at least one of the consecutive
major versions you aim to support, and the error message says exactly what and
where you have to fix in order to make it working.
As says an Italian proverb: chi va piano, va sano e lontano.
—Claude
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php