Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85502 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68454 invoked from network); 27 Mar 2015 12:21:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Mar 2015 12:21:14 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.51 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.51 mail-wg0-f51.google.com Received: from [74.125.82.51] ([74.125.82.51:36721] helo=mail-wg0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 16/64-38005-93B45155 for ; Fri, 27 Mar 2015 07:21:14 -0500 Received: by wgra20 with SMTP id a20so97049112wgr.3 for ; Fri, 27 Mar 2015 05:21:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=zbPiCu0ZkI117hmkSrFDWG9JBbgH70tBpJ2z5sSmbTE=; b=xWXkOugnxuDlPoOuc6lewbnK02Un4F7q1rWMr4s0GZ4Ps0Tm/0GgO2cT5oSQpYLgwg 6ewJmzhhSRQidXEKqRXMD6wROzgqIaIOzDMXiBYMBhK3qtsi2dBihQZaVAIdg+oXN40G II8+yMihZPPBDVq6UHCqcU4i4odPiqul8z37aYRj1NeSmi8ro/aA3pG1SHAXBssZIX3k iLYfFiT4FJOcOkwmZ4u6WOo1MPjb4SvojM7dAZgjGZIIJkWoRVoq8q/HLkYSCE/3D/Cw 2aU0RdzynA1pdJgF0kjDzVIxc6ct4dcmlqsC94tM93Q5lBE6aBcrzW1CgD72ZXrInIuK o9mg== X-Received: by 10.194.85.233 with SMTP id k9mr36194889wjz.31.1427458870791; Fri, 27 Mar 2015 05:21:10 -0700 (PDT) Received: from [192.168.0.159] ([62.189.198.114]) by mx.google.com with ESMTPSA id u16sm2641271wjr.5.2015.03.27.05.21.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Mar 2015 05:21:10 -0700 (PDT) Message-ID: <55154B02.6060100@gmail.com> Date: Fri, 27 Mar 2015 12:20:18 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: internals@lists.php.net References: <20150326224056.GB28328@phcomp.co.uk> <822A4769-D028-425A-A1A9-0626414B9B29@gmail.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Fix the Tenary Operator -- Please!? Please? From: rowan.collins@gmail.com (Rowan Collins) Michael Morris wrote on 27/03/2015 12:03: > 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. I disagree. It would be perfectly easy for someone used to another language to be developing in a PHP 7 environment, use the idiom that's familiar to them (chained ternary operators as a kind of if-else expression), and see the results they're expecting, all without knowing it will work completely differently run in a PHP 5 environment. The rest of the code might well run fine on PHP 5, since other than scalar type hints, there's really not that much that's changed. Do you really think every PHP library is suddenly going to find loads of uses for the spaceship operator that are so pressing they'll bump their minimum version requirement to 7.0? Breaking loudly when moving between versions is always going to be better than behaving differently in a very hard to debug way. > 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. Yes, that's why I suggest non-associativity - very little current code will break, anyone trying to use the unavailable idiom will get instant feedback that it's not supported rather than unexpected behaviour. And then later, when 8.0 rolls around, we can look at adding in the correct associativity, knowing for sure that no PHP 7 deployments will be affected. Regards, -- Rowan Collins [IMSoP]