Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117920 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 51798 invoked from network); 12 Jun 2022 18:39:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Jun 2022 18:39:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E9A9A18037E for ; Sun, 12 Jun 2022 13:26:18 -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=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS19151 66.111.4.0/24 X-Spam-Virus: No X-Envelope-From: Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 12 Jun 2022 13:26:18 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 8C9C05C00F4 for ; Sun, 12 Jun 2022 16:26:15 -0400 (EDT) Received: from imap52 ([10.202.2.102]) by compute1.internal (MEProxy); Sun, 12 Jun 2022 16:26:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1655065575; x= 1655151975; bh=jIli1+DleEefuvouzLTOxPRqcp+BnFaS+Dfbg2STXVU=; b=U K0xHk0tybVGeZRi87eDVTGvPq9j1Roc0T2W/kNg1cXYVnmrWMm9jqnQyMcqqOa7u iWp9/YVRx8SC7BIj68180Uav7fszCv7nVakzdaOCs3Eke3ahyoMr7Oz5qmkWj4Tw k/hulV2onMk5HkWjckwg3uv8R2sDAtm8zLRO88Gr27UV3s92ghfXNKS/uUd79E7A KYM4fyJs0bBH/RM+ZU80WL/OtVE1zs0BZTxNiRqD0wZmdf21fxmoSRCHD/cJ4pQx n6idmdzA6KQE14VcCEG8t7o/8i8q3iQcE1I3H8s2o5rMVAdfkkqo9wxEUyTAxP5U QcbsC7pX/nVkxNrulCttA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1655065575; x=1655151975; bh=jIli1+DleEefuvouzLTOxPRqcp+B nFaS+Dfbg2STXVU=; b=Vfc+GPS0TGsl/bUf4MhHkTETlnOI/h5BWRPMePpcxeeb +jWCPgrUKGH/fDu0AN3YwaaLEjBikkNPSJBxEzrXErkkcHon5LTb6IFIQ50YEHzC yhpS3MoRodSXRg5fjBKKj9bgAf2XPq8ZtsEgeHpWUJeapmv9NLR7WXU8BKCN+TGX LK+bBucaptdg+jKpkN5RQrPisOHnFa+UvwO29Cru4qD/X2iUlCOrS9j11H3OsXBV oKVt70g5ix/ouDiVR+3ZWKZXwHvoylsogUUG8XMY7AimIcs9xOe6fS3uyLxLykmx tGFYM5Qkt61i6xGrt3UVSkXFPd2MBG+VSNojB8Ioyg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudduhedgudeghecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnhepgeelgfekudeivddvteffueejffdthfejieevhefg ffekudevkedtvdelvddvffefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 2B35AC6008A; Sun, 12 Jun 2022 16:26:15 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-692-gb287c361f5-fm-20220603.003-gb287c361 Mime-Version: 1.0 Message-ID: In-Reply-To: <036bb10b-3e21-8516-db56-75a8c0fa964e@demon-angel.eu> References: <2b35605f-8da8-46b1-aec3-00bd1bfe47fd@www.fastmail.com> <2279cbd2-fcfe-460f-97f9-0029b7b043bb@www.fastmail.com> <036bb10b-3e21-8516-db56-75a8c0fa964e@demon-angel.eu> Date: Sun, 12 Jun 2022 15:25:54 -0500 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] [RFC] Short Closures 2, aka auto-capture take 3 From: larry@garfieldtech.com ("Larry Garfield") On Sun, Jun 12, 2022, at 12:54 PM, Mark Baker wrote: > 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. New run to check for that: Total used variables: 11534 ByRef used variables: 1833 So around 13% of used variables are by-ref, and thus would need to be explicitly used even with the new syntax. > 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. I... don't see what relevance that has? The potential for confusion is at the definition point, not call point. If a closure is used inline then those are the same place, but if they're not, it's only the definition point that is relevant at the moment. --Larry Garfield