Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117917 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 40389 invoked from network); 12 Jun 2022 16:07:11 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Jun 2022 16:07:11 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8616618054A for ; Sun, 12 Jun 2022 10:54:13 -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=-0.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS398810 136.175.108.0/24 X-Spam-Virus: No X-Envelope-From: Received: from mail-108-mta232.mxroute.com (mail-108-mta232.mxroute.com [136.175.108.232]) (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, 12 Jun 2022 10:54:12 -0700 (PDT) Received: from filter006.mxroute.com ([140.82.40.27] 140.82.40.27.vultrusercontent.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta232.mxroute.com (ZoneMTA) with ESMTPSA id 181590d386100028a7.001 for (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256); Sun, 12 Jun 2022 17:54:07 +0000 X-Zone-Loop: b7f84bcd884f897aa875fb45cc5203673a0522cbd941 X-Originating-IP: [140.82.40.27] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=demon-angel.eu; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: From:References:To:Subject:Reply-To:MIME-Version:Date:Message-ID:Sender:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=B11Zg143odb/u0xsUfeI4wUnV6gzM/NTQ5zD+F6U0NQ=; b=T6BEkyloAwPfENefOpbnpZ/2Nu 0kEbUWOfSyvououFqDeWPM+RZz8fHB4MYC09IQj+FXNd2pnFE6WmY2Ta+jqfJ+CqFdh6YMqjHdaTa XGfTFREk7LnnLdVem8ouhESuSNQd2pFOVHQZjXjF4yWBAjDX4zlSmsM8gC9hgdd6+BxBlrSPwRYS/ 3zFBLmgkCwiPlgsI08kXxO6hVbM526Ve9bM84BtAi9UZot3lsixwCuyGWbh0dwl9FEljWRzgPPrhg ssSbsTczCnsyGkWVt4l0nYigUFiBDpk2L0xWFrJywtbBL9l399VhX8qKPIAofqdQuhVzFILalMl2k tvkynqlA==; Message-ID: <036bb10b-3e21-8516-db56-75a8c0fa964e@demon-angel.eu> Date: Sun, 12 Jun 2022 19:54:06 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Reply-To: mark@demon-angel.eu To: internals@lists.php.net References: <2b35605f-8da8-46b1-aec3-00bd1bfe47fd@www.fastmail.com> <2279cbd2-fcfe-460f-97f9-0029b7b043bb@www.fastmail.com> In-Reply-To: <2279cbd2-fcfe-460f-97f9-0029b7b043bb@www.fastmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-AuthUser: mark@demon-angel.eu Subject: Re: [PHP-DEV] [RFC] Short Closures 2, aka auto-capture take 3 From: mark@demon-angel.eu (Mark Baker) On 12/06/2022 19:21, Larry Garfield wrote: > On Thu, Jun 9, 2022, at 11:34 AM, Larry Garfield wrote: > > A little data: > > I used Nikita's project analyzer on the top 1000 projects to get a rough sense of how long-closures are used now. All usual caveats apply about such survey data. I was specifically looking at how many `use` statements a closure typically had, and how many statements it typically had. Mainly, I am interested in how common "really long closures where the developer is likely to lose track of what is and isn't closed over" are. > > Total closures: 20052 > Total used variables: 11534 > Did many of those closures use "pass by reference" in the use clause, because that's one real differentiator between traditional closures and short lambdas. There's also the fact that use values are bound at the point where the closure is defined, not where it's called (if they even exist at all at that point), although that's probably more difficult to determine. -- Mark Baker _________ |. \ \-3 |_J_/ PHP | || | __ | || |m| |m| I LOVE PHP