Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111180 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 66856 invoked from network); 24 Jul 2020 20:36:52 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Jul 2020 20:36:52 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B579E18053F for ; Fri, 24 Jul 2020 12:31:53 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 24 Jul 2020 12:31:53 -0700 (PDT) Received: by mail-wm1-f45.google.com with SMTP id x5so8307533wmi.2 for ; Fri, 24 Jul 2020 12:31:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=Va0sGqXVerxc6Xz7H6BL7ekAxNPtEpzy2u7ZbmEA7A4=; b=G41rNt9yTVJIo7/D9AYA0gKEhzfeoPsE8nHiBabSMAjtTXHkAXR49liL94lNDx+PK6 zPbIAGAkGJe/0sDdGtc3HtJHSCfjeoesWFIS+Gp+wJHmF/Rkmuybkw4m95aaF87+nOft VokrI4Pqbd+vW3W4oeSCZylCAC/cT7FzL0sLWICzvocRue/UjHc9OqHvrK4ds+OvbFp1 oSz4sjCIVx2y+wQfRB+4PPuhKCZDVrSMiuQroSKEM4/Ctk6xZPecm+7loWGast70uxIP nya9j/y4X+qi90BOhkqpWu9Twk9OCXhdCEuD7+FdbhE9uBIu+jUi2+K0JpG1azORrlaE d5Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=Va0sGqXVerxc6Xz7H6BL7ekAxNPtEpzy2u7ZbmEA7A4=; b=QZvArKc7ddO/iMY1AZksj90FoDGAh9Ppp20s0t68+TRiAnL1I65rMF8LnLxZpsxcB+ QMPEc+OpvjsL/p4o/shq36kzWLTbJhkYlUWDNMpc+KrwD0jGQt6VXDN/5d1QbOkTvSwv V4wl4RCu5npMHivwoLToOj4mO4ztn+Lsl5eYirF9zP7KFF8HS4kchyDHU/TqxAcZ2puA GgQXg18hWozRnATCJb7YQofsmiKJg2iIsVgBs2RAJMta4Hmt1xjRMQbdjAiUtdQGoP2K y7WqDiiv8tmfVAc/IZFkuET2uVidX0jH+dV4+LsHm3r5Ld/aiSKRp7TItREwDGU/2H5G 6GZg== X-Gm-Message-State: AOAM531KIbLiYm9xT6gU6hq2i680N/KGbk9i0zmlMlnQ439EnUcp7IjH pEj8BilXXOurkWmRaT94so9+mCqE X-Google-Smtp-Source: ABdhPJyEQZEIaNPCKGb/ozgX7mDdYzQWH1b4swEOgcwYrW9KG9BXN1aV/EJuA/iO/4ZI3dD+kDR8HA== X-Received: by 2002:a1c:1d2:: with SMTP id 201mr9400688wmb.132.1595619105609; Fri, 24 Jul 2020 12:31:45 -0700 (PDT) Received: from [192.168.0.22] (cpc84253-brig22-2-0-cust114.3-3.cable.virginm.net. [81.108.141.115]) by smtp.googlemail.com with ESMTPSA id m16sm2260807wrr.71.2020.07.24.12.31.44 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Jul 2020 12:31:45 -0700 (PDT) To: internals@lists.php.net References: Message-ID: <36d212ae-f5ef-9577-4077-ec43cfa8856d@gmail.com> Date: Fri, 24 Jul 2020 20:31:42 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [PHP-DEV] Ternary associativity From: rowan.collins@gmail.com (Rowan Tommins) On 23/07/2020 13:26, Nikita Popov wrote: > PHP currently has an incorrect right-associative ternary operator. In > https://wiki.php.net/rfc/ternary_associativity the use of nested ternaries > was deprecated, and was supposed to become an error in PHP 8.0. > > Concurrently with that proposal > https://wiki.php.net/rfc/concatenation_precedence made a very similar > change to the concatenation operator precedence. The difference here is > that this throws a deprecation notice in PHP 7.4 (same), but changes the > behavior in PHP 8.0 (rather than making it an error). If anything, I would argue for making both of these into errors, if that's possible. I think the biggest risk with this kind of change is not existing code relying on the old behaviour, it is code relying on the *new* behaviour which is accidentally run on older versions of PHP. To give a real-life example, libraries that supported PHP 5.3 sometimes received patches containing the short array syntax introduced in 5.4. Since few projects have perfect test coverage and CI builds against multiple targets, these might end up in tagged releases. They were soon spotted by 5.3 users, because they caused a fatal error. A similar mistake involving concatenation or ternary precedence (with code tested on 8.x and run on 7.x) would lead to much subtler bugs, and might go undetected for longer. I realise that I am advocating an extra delay here, where I just argued the opposite regarding named parameters. I think the cost-benefit analysis comes out differently, notably on the benefit side: - raising an error has significant benefits over the current behaviour, since it makes mistakes easier to spot - the remaining benefit of the full change is only a mild convenience, since the behaviour can be achieved by adding parentheses Regards, -- Rowan Tommins (né Collins) [IMSoP]