Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113185 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 62648 invoked from network); 15 Feb 2021 20:20:04 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Feb 2021 20:20:04 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 55C7D1804B3 for ; Mon, 15 Feb 2021 12:06:38 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, 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-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 ; Mon, 15 Feb 2021 12:06:37 -0800 (PST) Received: by mail-wm1-f42.google.com with SMTP id a132so725647wmc.0 for ; Mon, 15 Feb 2021 12:06:37 -0800 (PST) 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=s/QgkQOrOoZ0EQUW546ErsCd3zaxhLqR1joyP3Uh6kM=; b=kR7Xn9lciobfBWVvQp3GnY7tHw1VZ6bseQi5hdjOiniVA5kM6pU5bHHU0sN3acAWB2 syfRJac1SDRH+Sbu7pRl1O3G1dga/vX5GJ89lAwOxo0Hs/5kPEcbfdpob0jU5oBJS4sL YnzZXXM+X1efs0WQ4zkkCNFcFxOK9HYql7Nr+TZmP38kLbNDVaCCvHqdWTRsI3syEHo4 elbNw0oh2I+6o3rgPz4eMkIbY8quz/TSeR/xSrVni+8HhHztsS17YdY+gEYvLqldnC4s /m3gGtzfYCp/ahULpQFi21FtkcQhYbu4nJpgVy5BuOE8K2GBZbqBbSkAzOH0NTaZqpF1 RU6A== 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=s/QgkQOrOoZ0EQUW546ErsCd3zaxhLqR1joyP3Uh6kM=; b=s84pmjOo4hACKrkqt/pzPgfvTHTXs3RD4zrzglUx1WzwcNofXcXfjvh5sIM2urpJMs JQ0x53DQDF3LmW4jqNk5mVLtz4yMKT0ZOOdRF1P7mCS5rgHiBXJj0fA01ptMdEdDzpON ecvZDUw34dOIKb5IUOlh0RcWQuuAHhb2AdRgvx5dXLmkDRUfVO5zW5T3vfNctH1LALIj TGVKNtKTY18VJntXEdeIFcx3AVHXSyYzHY618CYmiKsjs/QkHvg1d15J68gMctSnQnFw PK0ZKnV6ERHi8FlR94t5tLqhybwQcpUpHQeI8d/TrgX1fB6C6GunadMXFGqcCSnl0yaN G01A== X-Gm-Message-State: AOAM532awHtIN7JL0qtj/ELkEZk63H5tu5AN8LWs1cUvwNpYV5TFzMqY 49HVguUOO44Vn4Pi3ma9676CGz8LEHE= X-Google-Smtp-Source: ABdhPJxJi2+6E2JVpOBnmpxzjBFBpuMckakXcikOkpKvuoVksD262qnEOe9cizsq/2bvTkKOz3G0ew== X-Received: by 2002:a7b:c248:: with SMTP id b8mr413257wmj.25.1613419594892; Mon, 15 Feb 2021 12:06:34 -0800 (PST) Received: from [192.168.0.22] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.googlemail.com with ESMTPSA id a21sm653270wmb.5.2021.02.15.12.06.34 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Feb 2021 12:06:34 -0800 (PST) To: internals@lists.php.net References: Message-ID: Date: Mon, 15 Feb 2021 20:06:37 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 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] Whitespace around Paamayim Nekudotayim (double colon) From: rowan.collins@gmail.com (Rowan Tommins) On 15/02/2021 14:52, Matthew Brown wrote: > The most comparable example is between namespace separators: > > Ns \ bar(); > Ns \ SOME_CONST; > > are both syntax errors. As Sara says, this only became an error in 8.0, and there was a rather specific reason for it, but I think there is a philosophical difference, too. "\" is part of a single piece of syntax: a fully-qualified class, constant, or function name. You can't write $foo\Bar or Foo\$bar or $foo\$bar. "::" on the other hand is an operator that can be used in a variety of ways. You can write $foo::bar(), Foo::$bar, $foo::$bar, {$foo . 'Handler'}::handle(), parent::foo(), and so on. It stands to reason that it would have the same whitespace rules as any other operator. > I was surprised to learn that PHP treats :: similar to -> I think it would be rather surprising if it *didn't* treat the two operators similarly, since they're so closely related. > I wonder if there's a benefit to removing a small potential footgun from > the language? I'm not really sure what the footgun here is. Adding newlines around just about any operator you can think of will lead to code that confuses at first glance: $x = [     1,     2,     3,     4,     5 ] // Wait, we're not done yet... [2]; Short of changing the entire language from semicolon-delimited to newline-delimited, that's inevitable. Regards, -- Rowan Tommins [IMSoP]