Re: Fix incorrect ternary '?' associativity for 7.0?
| From: | Sara Golemon | Date: | Tue, 16 Dec 2014 08:29:57 +0000 |
| Subject: | Re: Fix incorrect ternary '?' associativity for 7.0? | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-79699@lists.php.net to get a copy of this message | ||
On Mon, Dec 15, 2014 at 8:56 AM, Derick Rethans <derick@php.net> wrote:
> On Sun, 14 Dec 2014, George Bond wrote:
>> If you wanted an upgrade path that was not Evil (in the sense of not
>> introducing subtle and hard-to-diagnose bugs), could you not change
>> the operator to be *un*associative in PHP7? That would effectively
>> just make concrete the discouragement/deprecation that's already in
>> the documentation, and would produce irritating but very visible
>> errors for anyone still actually using this functionality, as well as
>> making them alter their code in a forward-compatible way. Then if you
>> want to think really long term, plan to implement the 'correct'
>> associativity in the *next* major version.
>
> As long as this unassociativity turns it into a hard syntax error (ie,
> "php -l" will catch it out), I am not against this.
>
I'm with Derick. We either don't change the implicit associativity,
or we make ambiguous statements a parse error with a clear link to the
documentation explaining to add parens in order to make the
associativity explicit.
-Sara