Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113744 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 14658 invoked from network); 24 Mar 2021 17:38:15 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Mar 2021 17:38:15 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 79D5A1804F4 for ; Wed, 24 Mar 2021 10:34:02 -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=-1.9 required=5.0 tests=BAYES_00,HTML_MESSAGE, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from darkcity.gna.ch (darkcity.gna.ch [195.49.47.11]) (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 ; Wed, 24 Mar 2021 10:34:01 -0700 (PDT) Received: from wafer.home (unknown [IPv6:2a02:1205:5053:a220:311b:427c:e958:c67d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTPSA id 22339150ED21 for ; Wed, 24 Mar 2021 18:33:54 +0100 (CET) Content-Type: multipart/alternative; boundary="Apple-Mail=_3473277C-9A2D-4CB2-A632-235DC1F019A4" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Date: Wed, 24 Mar 2021 18:33:54 +0100 References: <88c9eb5f-f80c-4869-b7f8-1b58b9e2eaa3@www.fastmail.com> To: php internals In-Reply-To: Message-ID: <4DC3B66E-A91A-4AA9-8872-8EE9DE92C2D4@cschneid.com> X-Mailer: Apple Mail (2.3654.60.0.2.21) Subject: Re: [PHP-DEV] [RFC] Auto-capture multi-line closures and short functions take 2 From: cschneid@cschneid.com (Christian Schneider) --Apple-Mail=_3473277C-9A2D-4CB2-A632-235DC1F019A4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Am 24.03.2021 um 18:15 schrieb Chase Peeler : > I guess my one question would be why we didn't support auto-capture = when we > first implemented anonymous functions, and if there was a reason, why = does > that no longer apply? My guess would be that it was seen as one of PHP's big strength that = variables don't just leak into other contexts but that it has to be done = explicitly. Now with arrow functions both the benefit of auto-capturing is bigger = compared to the actual function 'body', it normally only spans a line or = two and (for me personally) the absence of {} also kind of make the = leakage fit my mental model more easily. For these reasons I think I lean towards -1 for both = https://wiki.php.net/rfc/short-functions = and = https://wiki.php.net/rfc/auto-capture-closure = as they add more syntax = without (IMHO) a huge benefit. You might be able to convince me otherwise though ;-) - Chris --Apple-Mail=_3473277C-9A2D-4CB2-A632-235DC1F019A4--