Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113790 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 52952 invoked from network); 25 Mar 2021 17:20:49 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Mar 2021 17:20:49 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 626BF180594 for ; Thu, 25 Mar 2021 10:16:52 -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,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 ; Thu, 25 Mar 2021 10:16:51 -0700 (PDT) Received: from wafer.home (unknown [IPv6:2a02:1205:5053:a220:f586:6cb5:8594:8b46]) (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 83647150ED1F for ; Thu, 25 Mar 2021 18:16:49 +0100 (CET) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Date: Thu, 25 Mar 2021 18:16:49 +0100 References: <88c9eb5f-f80c-4869-b7f8-1b58b9e2eaa3@www.fastmail.com> <43a2b198-ab3d-411a-b978-2924e6af4b13@www.fastmail.com> To: php internals In-Reply-To: <43a2b198-ab3d-411a-b978-2924e6af4b13@www.fastmail.com> Message-ID: <98882A42-D265-41E5-8C67-4A1B38A2E932@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) Am 25.03.2021 um 17:25 schrieb Larry Garfield : > So in conclusion, it seems the reasons closures weren't auto-capture = always were: >=20 > 1) Possible performance concerns that are no longer relevant. > 2) Avoid surprise references. > 3) Allow users to capture by value or by reference. >=20 > Point 1 is no longer relevant as the engine has changed so much. > Point 2 is no longer relevant since forever, since capture is by-val = by default. > Point 3 is only relevant in the cases where you need to capture by = reference, which in practice it turns out are really quite rare. >=20 > So, I would argue that all of the reasons for manual capture in the = first place are no longer relevant, except in the edge case where you = really do want to capture by reference. While the discussion back then revolved a lot around performance and = references I don't think 4) Local-as-default scoping and explicit captures are the PHP way and = make it a better language which was mentioned in this thread should be buried ;-) - Chris