Rowan, I seriously, seriously doubt anyone would write PHP 7 compliant code that only takes advantage of ternary associativity, a feature that is only occasionally useful. If they can't take the hint from the parse errors arising out of the spaceship op and all the other stuff being added, they're too dumb to be programming and need to find another line of work.
While breaking backwards compatibility for its own sake is bad, avoiding it to keep a bug in the system is worse in my opinion. And again, this is a bug. If the way PHP associates could be used for something that would be different, but it can't. I honestly doubt any code even exists that takes advantage of the current behavior. On Fri, Mar 27, 2015 at 4:57 AM, Rowan Collins <rowan.coll...@gmail.com> wrote: > On 26 March 2015 22:40:56 GMT, Alain Williams <a...@phcomp.co.uk> wrote: > >On Thu, Mar 26, 2015 at 10:31:00PM +0000, Rowan Collins wrote: > > > >> What I've always been annoyed by is the *precedence* of the operator > >- having to add brackets to mix it with string concatenation, etc - > >which it turns out to is the same in all sorts of languages. > > > >It is the ''all sorts of languages'' that is key here. The point is > >that PHP > >associativity for ?: is different from other languages and it is that > >that > >confuses and leads to bugs. What is right/wrong is not as important as > >all > >others doing it the other way. > > This reply is competely out of context to the message you quote. Yes, I > know that the *associativity* of the operator is wrong. My contention is > that in practice, few people ever try to associate multiple instances of > the operator, so few bugs result from it not working. > > I contrasted this with *precedence*, particularly the precedence of an > expression mixing the ternary operator with string concatenation, which is > a much more common thing to do. But here, PHP is doing the "right" thing, > if measured by other languages doing the same. > > Personally, I'd be in favour of making the operator non-associative, thus > breaking obviously if people try it. Changing it now would result in people > using it in PHP 7, then running the code under PHP 5 and having obscure > bugs to fix. > > Regards, > -- > Rowan Collins > [IMSoP] > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >