Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119715 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 25187 invoked from network); 15 Mar 2023 18:17:10 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Mar 2023 18:17:10 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 47815180506 for ; Wed, 15 Mar 2023 11:17:07 -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 ; Wed, 15 Mar 2023 11:17:06 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 617255C01C6 for ; Wed, 15 Mar 2023 14:17:06 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute4.internal (MEProxy); Wed, 15 Mar 2023 14:17:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :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=1678904226; x=1678990626; bh=ZLljZLRZl1 NB7BMPCzNt/xzMev0dFRau/VhaYN5sQ64=; b=c4JxwPds2P6ppiO0l6kQIApKNL cqoFH7mLx1Op9zQ5VZ1GUiLXi7+k5sUayp0oV/Km1IeMZit2R1YXWNhZS6kYw/Gm 58EszIUELoZMK+aeMoaen82GTZ4m+Un78vAzcuGM/k41AhrRX9qeIT04VaOJkyNa 9T5O7LtPRdblGbIVZW+kAcramevU9FIyjEg2XjdLaIaUgW+FCbgQnbztnIrsKze9 gvubVDcH4cT3jPN/QCDOn0l7ozJMjXWI0HtvKrjUroYGslANyA9x+la5Z4c1uewX zzc+SMKxOabloHjQ66jCU7qqhy8WhWJlEY3U4F/W+txz8K2TLxK3sdy9MCzw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :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=1678904226; x= 1678990626; bh=ZLljZLRZl1NB7BMPCzNt/xzMev0dFRau/VhaYN5sQ64=; b=G +ZiQDGiSgkzzUx9W0iL3b54wAiywh5VpEoMOzfNlmtNt28CYLZC8Lsiy01lVBgBn i0zmAG/3c986XUT5ynGQPaYYxD+m4vo/cc7+iPEG5S9IoaWkLeAM2wkM18HGWg3n uD9axN7HBpS7su5EcfEhhkyTB3IqrBS5NTI9abCClSYUT9yHkGx29O0FkuKxfSfk wgDKaWx0xSEZACCGfDVGNisRhRKRsJQUOCZTSC3WnsvK6DUYeDF6l/ReGnEWZk8M Qd/AxBFcibOp59g9b9K/0Rgse91nDG2vWpvk7XgQuz4Gu0PoGEDn4UQz+CS/yM5D CGSRqd5kfczPK0PSUwaAg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvddvkedguddutdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtgfesthhqredtreerjeenucfhrhhomhepfdfn rghrrhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrd gtohhmqeenucggtffrrghtthgvrhhnpeeggeehgfetjeehgefggefhleeugefgtdejieev vdethfevgeeuudefleehvdetieenucffohhmrghinhepphhhphdrnhgvthenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghr fhhivghlughtvggthhdrtghomh X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 20FEE1700089; Wed, 15 Mar 2023 14:17:05 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-221-gec32977366-fm-20230306.001-gec329773 Mime-Version: 1.0 Message-ID: <4bf1706b-308c-4aa2-9f1d-a31add575f9c@app.fastmail.com> In-Reply-To: References: <8a9a04b3-45e6-47dd-dee8-0f524e49bd37@gmail.com> Date: Wed, 15 Mar 2023 13:16:32 -0500 To: "php internals" Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Brainstorming idea: inline syntax for lexical (captured) variables From: larry@garfieldtech.com ("Larry Garfield") On Tue, Mar 14, 2023, at 10:28 PM, Alexandru P=C4=83tr=C4=83nescu wrote: > On Wed, Mar 15, 2023 at 1:09=E2=80=AFAM Rowan Tommins > wrote: > >> On 14/03/2023 22:54, Larry Garfield wrote: >> >> Well, a large part of my resistance to automatic capture is that it >> makes variable scope less visible at a glance. This avoids that by st= ill >> having a marker for "I am from another scope", but a much less verbose >> one than the current use() clause. >> > > How about first implementing use() for anonymous classes first? > Something like: > > function foo(int $outer) { > return new class() use($outer) { > public function getIt() { > return $outer; > } > }; > } > > This would help with the main problem you expressed and be a less conc= ern > for the future. > > It's a different direction from what you suggested but it might be a l= ot > harder to pass a $^ syntax or similar. > > Regards, > Alex For the record, while the auto-capture RFC[1] didn't reach a 2/3 majorit= y to pass, it did have a strong majority support (62%). Given that, I t= hink it unlikely that a "require verbose manual capture in more places" = proposal would fair that well. [1] https://wiki.php.net/rfc/auto-capture-closure --Larry Garfield