Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113186 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 65205 invoked from network); 15 Feb 2021 20:39:21 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Feb 2021 20:39:21 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 98DE51804B1 for ; Mon, 15 Feb 2021 12:25:55 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, 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-vs1-f46.google.com (mail-vs1-f46.google.com [209.85.217.46]) (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:25:55 -0800 (PST) Received: by mail-vs1-f46.google.com with SMTP id w13so1128050vsw.6 for ; Mon, 15 Feb 2021 12:25:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FftvMcf6aRASpGph8mZh6HQQB1iG0SVvrXV3I+xSoCg=; b=lpqdCEIfd+Z5CezjiAWukS5j9IjllrQhpifkFnert+HR/C6rAC5KXyui7OTtMzt2sF YrqXP+fcXH+hRgERi47Lyl7cRuxoarF8xrQrxx/OHa0iSsec9UhsywJTKGzVj6lfqp2V b+SD/bfvlX8pDDAVgy2Fb4RiFl8zZrtK+usgiUL7JRUC93WwbWaN/Pj46DCWRggVGL+H OXqetNYuqJU9cMYY6oDRxV/ruW0ltMLUI0xs1vn+jOzCPqGZXUYdvgRx9avQ/m3+T/pT +RVqY3hdz+HUcUSGhvlOGaUcZ5THtD1XjzJkfp2rmFQKEatYhGTPOxp/hU7kWRtdCkEV qi2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FftvMcf6aRASpGph8mZh6HQQB1iG0SVvrXV3I+xSoCg=; b=jS1yKKgA2JtUjN5L8SAOcBK2gQaulFINqpqtJv+D08rtBBPuicmmasnaxKYfJ3ZCgZ 6OWgD4x5TtMd61jfqdezg0baJoLzBgdrQjayCYzu92T2YhwIt0AKSn+pje+TH43/e6AY NlMuXlUD8cKQ5CRNutkTJ/raRGIUDx/ozR2SsWim6siJPEpShP8kODdBeQBK7VOUeTcp 60avu3T/RZMvXKAiRbgGlJF+MlXfDLnH5GDpZ+djgRp02xcph+IX/RDSnmFmIABgjT5k JSZiGhQ5abQ1KtWC4yQ8HlwoGD90kEsNQ5BjdHq1rmpLl4u9t3XQwRZafZ1WTl670wV/ BTVw== X-Gm-Message-State: AOAM530mbE1T4jAP5HBjq0IcC6QGc1U+S9gIz6PTgyNdnQhkKfR+lPKv lOPMK6e1Lw5HdYryM4zAd5FtkQvHPXJMxEiSR+4= X-Google-Smtp-Source: ABdhPJxUOkE78wewNvFEdYSwdcdeADtLfmuI4mc7RnAZyWNze09Ht1QR/WCS42sYKd1f/1fnxVhlYiaohu8GRgbdp6I= X-Received: by 2002:a67:ea54:: with SMTP id r20mr9482119vso.9.1613420753686; Mon, 15 Feb 2021 12:25:53 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 15 Feb 2021 15:25:42 -0500 Message-ID: To: Rowan Tommins Cc: Internals Content-Type: multipart/alternative; boundary="000000000000e5957c05bb65ca38" Subject: Re: [PHP-DEV] Whitespace around Paamayim Nekudotayim (double colon) From: matthewmatthew@gmail.com (Matthew Brown) --000000000000e5957c05bb65ca38 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks, now I realise I was probably wrong to bring this up. I had it in my mind that "::" could never appear chained together (thinking of constants), but it's just that I've never seen code that chains them together =E2=80=93 i.e. this is valid: A::b()::c()::$d::$e =3D 5; On Mon, 15 Feb 2021 at 15:06, Rowan Tommins wrote= : > 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 fro= m > > 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 =3D [ > 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] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > --000000000000e5957c05bb65ca38--