Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119704 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 63941 invoked from network); 15 Mar 2023 03:28:59 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Mar 2023 03:28:59 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 45BE518050B for ; Tue, 14 Mar 2023 20:28:58 -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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (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 ; Tue, 14 Mar 2023 20:28:57 -0700 (PDT) Received: by mail-pf1-f182.google.com with SMTP id v21so195367pfu.11 for ; Tue, 14 Mar 2023 20:28:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678850937; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=efhq9dZCfFD/fUx4SEOd1NnrrrIb63r+5NlHZyhCb7g=; b=oFBW+gka6mw/gSs/qO3g0d6yZdtV9BZwLHot2UMiGPZwoFbcE39M5U56DHaVlZ6p1y TTbqCQZ8oB1h8iB5i7MZckQwOxqsWmXXfj23K2HfKEQM9u9GnYg7JqotcFaL4R9EBym7 fSKOtUKZkKJ1msHzBSpdQsTBhHAVyvtJHpgcgMCAfaNixQV2f45gD5d8A+cK/zTRiyLR vLE6LVo86KotnmmZzzn34a8Z1DJc/DKyhws35uClfsY1661ikyTc7KzMALho47OEWn0U QwVERo2+Zj4NocmYi+OM2iIJBtBylq+EGmaRpZjXLNre8/o99nAs/sZx5sKt7dxTjogz QZnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678850937; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=efhq9dZCfFD/fUx4SEOd1NnrrrIb63r+5NlHZyhCb7g=; b=vJqszENuMJoIJeaQ/xL37puRRLh4NEIBtlwog17rDxJy39MukMkd18ZHHyWoEbgAry FJblegKjcK6LmbW+hvyFJM0FanrbbJJshYRsSDWmzdvfKDFaZ7UlvnvnyGDK6aBcDyLp rJCr37X7kYQZ3Foff3YfY3ATQt2Yzjhqo+5c7Auh3Zuww3IjPcNEtZdTRpU8KuYxBRfE vi5FxxXryA4SgvXex4pqdfkwirXnxWDlgqoPcuZqBS230CRl8TWpSDTQUCTvJeCKyAfp YDC5/nKLhF0Dqd8YphjkERdeD87vtktMTkc2oH2HAufN48NtCrsaPKQFxYXx/++UcEzW Q+4g== X-Gm-Message-State: AO0yUKUDzFWZkKz7Dj4iGE56SufagQLs7G4Bn4DtmV3SMUM8bJ3QE/jn 7CVJgfLZ2qpS5EgeRJIZfYK9K4dpGI8OBwWESNM= X-Google-Smtp-Source: AK7set83BCtCsGjeBMVubqfLLd2wjxc11HBVi1qKDAC1AFvQXW/+mi8Bka13x/psie/JDUB+XiwCi7hVISr1jQ7Qe3k= X-Received: by 2002:a62:1c11:0:b0:623:d994:17f1 with SMTP id c17-20020a621c11000000b00623d99417f1mr3303707pfc.5.1678850936517; Tue, 14 Mar 2023 20:28:56 -0700 (PDT) MIME-Version: 1.0 References: <8a9a04b3-45e6-47dd-dee8-0f524e49bd37@gmail.com> In-Reply-To: Date: Wed, 15 Mar 2023 05:28:39 +0200 Message-ID: To: Rowan Tommins Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000b3b99605f6e7f18c" Subject: Re: [PHP-DEV] Brainstorming idea: inline syntax for lexical (captured) variables From: drealecs@gmail.com (=?UTF-8?Q?Alexandru_P=C4=83tr=C4=83nescu?=) --000000000000b3b99605f6e7f18c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 still > 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 concern for the future. It's a different direction from what you suggested but it might be a lot harder to pass a $^ syntax or similar. Regards, Alex --000000000000b3b99605f6e7f18c--