Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113175 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 77751 invoked from network); 15 Feb 2021 06:04:16 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Feb 2021 06:04:16 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 062591804DC for ; Sun, 14 Feb 2021 21:50:40 -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.0 required=5.0 tests=BAYES_20,HTML_MESSAGE, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail1.25mail.st (mail1.25mail.st [206.123.115.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 14 Feb 2021 21:50:39 -0800 (PST) Received: from home.th-ayu.reay.family (unknown [49.48.218.247]) by mail1.25mail.st (Postfix) with ESMTPSA id C41DF603D0; Mon, 15 Feb 2021 05:50:31 +0000 (UTC) Message-ID: Content-Type: multipart/alternative; boundary="Apple-Mail=_2DFD125D-5B50-41E4-9BCB-47CBD0281304" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Date: Mon, 15 Feb 2021 12:50:29 +0700 In-Reply-To: Cc: Internals To: Matthew Brown References: X-Mailer: Apple Mail (2.3608.120.23.2.4) Subject: Re: [PHP-DEV] Whitespace around Paamayim Nekudotayim (double colon) From: php-lists@koalephant.com (Stephen Reay) --Apple-Mail=_2DFD125D-5B50-41E4-9BCB-47CBD0281304 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 15 Feb 2021, at 12:14, Matthew Brown = wrote: >=20 > Hey all, >=20 > Is there interest in prohibiting whitespace around double colons in = the > next major PHP version? >=20 > I was surprised to learn that PHP treats :: similar to ->, allowing = double > colons like >=20 > A:: > b(); >=20 > Looking at the top 2,000 packages in Packagist I can't find any = evidence of > people using a double colon with whitespace around, and my suspicion = is > that the use of it is basically non-existent. >=20 > I wonder if there's a benefit to removing a small potential footgun = from > the language? I can't really see any benefit to _keeping_ it (unless = it > turns out my analysis is wrong, and it's actually wildly popular). >=20 > Best wishes, >=20 > Matt Hi Matt, As a user-land developer, I would be very much against changing this. I=E2=80=99m sure it=E2=80=99s probably not a particularly common way to = format code, but the ability to chain method calls, starting from a = static call and have it formatted with one method call per-line is quite = useful IMO, eg: ``` MyModelClass ::find(1) ->where(=E2=80=98foo=E2=80=99, time(), =E2=80=98>=E2=80=99) ->where(=E2=80=98bar=E2=80=99, null, =E2=80=98is not=E2=80=99) ->readAll(); ``` But more generically - I can=E2=80=99t see why you=E2=80=99d think that = this one particular instance of extra whitespace being insignificant is = a problem, when extra whitespace is not significant anywhere? In other worse, can you explain why you think it=E2=80=99s a problem = that whitespace is not significant in static method calls, but it=E2=80=99= s not a problem everywhere else where it=E2=80=99s not significant? The two following examples are the extremes of extra whitespace vs = minimal whitespace, and your suggestion would introduce an arbitrary = inconsistency for one specific case.=20 ``` ``` ``` ``` Cheers Stephen= --Apple-Mail=_2DFD125D-5B50-41E4-9BCB-47CBD0281304--