Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79629 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96989 invoked from network); 14 Dec 2014 04:11:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Dec 2014 04:11:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.181 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.181 mail-wi0-f181.google.com Received: from [209.85.212.181] ([209.85.212.181:49655] helo=mail-wi0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2F/41-19873-6DD0D845 for ; Sat, 13 Dec 2014 23:11:03 -0500 Received: by mail-wi0-f181.google.com with SMTP id r20so6016399wiv.8 for ; Sat, 13 Dec 2014 20:10:59 -0800 (PST) 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=Knx3/Byu9zBJpCN6/GDiwOhCxG1WFOiXccY5KLA2McU=; b=Ic4FZRifi+2Ro0i2AhEhrGBd/adrAJfzJ1+5kqjEfCoWcd7UsQouioM37iRl8qh3XF 7eD4862dx/oBglTfwvnMMoKUOuQZ2Tcf1ZVM/wdoTFua6OcKFEC4EFpdPYh5N79VXw/I EKUd3PW4IUBe4BvwW/uBG97YhzbLRzLlp4S9jcHevVU9CkL8OLn//wbkPkzZ5guLFKat vOyMst65tjPsXyx37DI4sEQQOyEXpDELKdayj36dz3Kx0mAppOMnR9y7MQOsTFQNS70B JkEiuJ5YwXYpfhmuQMDhU9BVJE0lGvjWtRVd5FEMpP2tKGPOE9r9bme919F7r+3eq/CY hpVw== X-Received: by 10.180.93.37 with SMTP id cr5mr20774020wib.76.1418530259758; Sat, 13 Dec 2014 20:10:59 -0800 (PST) Received: from [192.168.0.2] (cpc68956-brig15-2-0-cust215.3-3.cable.virginm.net. [82.6.24.216]) by mx.google.com with ESMTPSA id ex9sm7856245wib.14.2014.12.13.20.10.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Dec 2014 20:10:58 -0800 (PST) Message-ID: <548D0DD2.5060501@gmail.com> Date: Sun, 14 Dec 2014 04:10:58 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: internals@lists.php.net References: <548CDF7F.3060805@gmail.com> In-Reply-To: <548CDF7F.3060805@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Fix incorrect ternary '?' associativity for 7.0? From: rowan.collins@gmail.com (Rowan Collins) On 14/12/2014 00:53, Leon Sorokin wrote: > Respectfully, > > PHP's 'Unexpected behavior is not a bug' stance is pretty infuriating [...] > Documentation of unexpected behavior does not make something 'not a bug'. Whether or not this particular bug is fixable, I do agree with this: "we're not going to fix this because it's hard / too late" is not the same as "this is not a bug". For instance, attempting to decrement a null value with the -- operator results in null, even though incrementing with ++ will result in int(1), and, even more bafflingly, using -= 1 will result in int(-1). This is documented behaviour, but with no rationale other than "it's always been that way". http://3v4l.org/bfsZ8 Apparently, this bug has been around since (at least) PHP 3, but does that really mean we're never allowed to fix it? At least the resolution to this report was "Won't Fix" rather than "Not a Bug": https://bugs.php.net/bug.php?id=20548 Personally, I consider the non-evaluation of arguments to undeclared constructors (see "Default constructors" RFC thread) to be another example (an unfortunate consequence of a valid optimisation, resulting in behaviour that nobody would have specified), although Stas disagrees. As I mentioned in that other thread, one of the implications of saying "it's not a bug" is to assert that it's part of the *language* to work a particular way, and so should be specified and reproduced in other implementations (from tests on 3v4l.org, HHVM carefully replicates the null-- bug, but not the no-constructor lazy evaluation). Changing it then implies changing the language specification, and other implementations matching the appropriate version. If, on the other hand, we accept certain things as *bugs in the implementation*, then other implementations may diverge in behaviour anyway, and a new major version released on php.net could (in a sort of philosophical way) be considered a new implementation. Now, the associativity of the ternary operator is presumably in the language specification already, and belongs there, as it's such a basic attribute of the operator. I'm also inclined to agree that the benefit may not outweigh the cost of fixing it at this stage, but I do think it's worth discussing. -- Rowan Collins [IMSoP]