Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85501 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66454 invoked from network); 27 Mar 2015 12:03:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Mar 2015 12:03:38 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmgx.michael@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmgx.michael@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.173 as permitted sender) X-PHP-List-Original-Sender: dmgx.michael@gmail.com X-Host-Fingerprint: 209.85.212.173 mail-wi0-f173.google.com Received: from [209.85.212.173] ([209.85.212.173:37386] helo=mail-wi0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1A/04-38005-A1745155 for ; Fri, 27 Mar 2015 07:03:38 -0500 Received: by wiaa2 with SMTP id a2so28177364wia.0 for ; Fri, 27 Mar 2015 05:03:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type; bh=h33otGPnrf18QdaAJZuabV+FlXo/t+auZznfDBgbfmo=; b=emw/C1+tPBOzF70Sslcg7B4/EPexMHbUa4V3IvuvFr7nySOYkZqI4KRjycD0QJvUvX ZnD7Wssx9PdZek5ZZGDFEPU+bhCCDzvAOFpRYQuKo8cI9I/9eZNJIov7eTiVJAJKyjcp L7ehSbquuqua6o7YN7BrnW227VSCbD3aoTxEOZC653HJOGwonxjpkYVNKkzpJV41AZZ/ ipGbuiwtRETTtXNdr2HCkwoowfCHBz6BwRpnwARdVgaUTaxNoa2HGj0UGOnuzxtK0hGn IcHMqz2+uLz7xIz7Db2BdDFDivMnJwZHwmvNvOWlD/+KCBKEWDqeZggr7p9ZFRMYp7S5 MVmA== MIME-Version: 1.0 X-Received: by 10.180.198.37 with SMTP id iz5mr54373500wic.95.1427457815156; Fri, 27 Mar 2015 05:03:35 -0700 (PDT) Sender: dmgx.michael@gmail.com Received: by 10.194.86.41 with HTTP; Fri, 27 Mar 2015 05:03:35 -0700 (PDT) In-Reply-To: <822A4769-D028-425A-A1A9-0626414B9B29@gmail.com> References: <20150326224056.GB28328@phcomp.co.uk> <822A4769-D028-425A-A1A9-0626414B9B29@gmail.com> Date: Fri, 27 Mar 2015 08:03:35 -0400 X-Google-Sender-Auth: 1nTBDFlmdAE6bG4XL_vY1ooFe0Q Message-ID: To: PHP Internals List Content-Type: multipart/alternative; boundary=047d7b604be8011bc5051243ec0c Subject: Re: [PHP-DEV] [RFC] Fix the Tenary Operator -- Please!? Please? From: tendoaki@gmail.com (Michael Morris) --047d7b604be8011bc5051243ec0c Content-Type: text/plain; charset=UTF-8 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 wrote: > On 26 March 2015 22:40:56 GMT, Alain Williams 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 > > --047d7b604be8011bc5051243ec0c--