Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119702 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 47086 invoked from network); 14 Mar 2023 23:09:08 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Mar 2023 23:09:08 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8C4F21804DF for ; Tue, 14 Mar 2023 16:09: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=-0.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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 16:09:07 -0700 (PDT) Received: by mail-wm1-f51.google.com with SMTP id l7-20020a05600c4f0700b003e79fa98ce1so24109wmq.2 for ; Tue, 14 Mar 2023 16:09:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678835346; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=U8vKOL9EioQgklb8cYKwL0N5ydWWZ7lmK/k3WnECBkU=; b=T5KkAprkNtfFGY2XqQgk0Kc3g4+4Oh3sz5s9qNYOtGmXUepsMczaH51ZBrcpdr8bS9 Rq+BhOsTJZ/rO+Te1C5MP10psVSMSKlmB75oV5+DFq4E9gacWrqUZ4ndIpiPREPdDWQn 2znGIRZQzm3gtf+j5VAiWeEgIYLM59iagusubEUqaBobijoDneZiMkqRcIxKjT8DL2Zm V9XsukXVl8bvcn9xVng9LW9+vlsfQfDvQjlIFVE5MB13lNWC74Y4KQkKXpq9ygCmalZm 68KDV93eahOa5pS1duZ7zoFod58zdFzCmNAJZbJIvH/FvYpaetP9Ldtz6tv+BI8VU2Ua eOFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678835346; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=U8vKOL9EioQgklb8cYKwL0N5ydWWZ7lmK/k3WnECBkU=; b=fjaoFwrhV5FWdn1eW050Z3YgkHEIyJKfF05rVb34ksm5PiDFRukP7KB9Gi94EJt759 /K9AoR9iICUv68JfPuOw53JHYzpWZsVXeiAEi1RV5KiN3YgyC68ofcaMIuBs6s08vsPH s8PzPDH3MGNBpJ4mxWVl3GRvcU9UeoAIb+FFxnY/ga4K2iipPexE3Ii8LP+Ipoxe90ey jk3M18rY/+xPubhyfyWuaAP19yHCDbkdjQsOFDioTuFh30ELsk1HCalshC65bKwuXUdw V+hVW9JAGyoVm17Di7DeKFUgwNKozeCDJCuPWD+OMHjkvoRzmXbOkRj3WI8ufUbmZFG2 T/Zw== X-Gm-Message-State: AO0yUKX9ZAtUffUwzSWbAswq8Uhp2Z4x2ru1MhLVPlOGYXdlE8WuDItq ++v97PC/Ke30zCDVfadRXDZA8LsH/co= X-Google-Smtp-Source: AK7set/nsoPxiR9Uf16P2DO489ho3FEDkRJ5Gee7/dTdLstqSjnw8w+LydHh6HQMoOG4sE1FtLwWQw== X-Received: by 2002:a05:600c:3b8e:b0:3ed:290b:dc68 with SMTP id n14-20020a05600c3b8e00b003ed290bdc68mr7179740wms.12.1678835345866; Tue, 14 Mar 2023 16:09:05 -0700 (PDT) Received: from [192.168.0.22] (cpc83311-brig21-2-0-cust191.3-3.cable.virginm.net. [86.20.40.192]) by smtp.googlemail.com with ESMTPSA id y8-20020a05600c364800b003ed2384566fsm4211983wmq.21.2023.03.14.16.09.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Mar 2023 16:09:05 -0700 (PDT) Message-ID: Date: Tue, 14 Mar 2023 23:09:05 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Content-Language: en-GB To: internals@lists.php.net References: <8a9a04b3-45e6-47dd-dee8-0f524e49bd37@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Brainstorming idea: inline syntax for lexical (captured) variables From: rowan.collins@gmail.com (Rowan Tommins) On 14/03/2023 22:54, Larry Garfield wrote: > However, I agree with Ilija that the original proposal to just do it automatically would be better; and if that didn't pass, I have no expectation that an alternate with a funky new syntax would do any better. 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. I may be in a minority of one on that point, though, for all I know. > The other concern is that this introduces a whole new realm of possible behaviors... That's kind of where the closure thought came from - it seemed a very close analogue, so having one syntax for both feels natural. Outside of those cases, though, there's no reason it should mean anything, just as $this->foo or self::$foo doesn't mean anything outside a class. In fact, it could be spelled capture::$foo or $scope->foo rather than just using new punctuation, if we wanted to encourage that analogy. Regards, -- Rowan Tommins [IMSoP]