Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117946 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 38757 invoked from network); 14 Jun 2022 14:16:38 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Jun 2022 14:16:38 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 79D1018050B for ; Tue, 14 Jun 2022 09:04:10 -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-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 Jun 2022 09:04:10 -0700 (PDT) Received: by mail-wr1-f43.google.com with SMTP id o16so11920430wra.4 for ; Tue, 14 Jun 2022 09:04:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=3u/4cbD1I8pAczbismccogm3dhTwZF0OtlB6RTL4L9E=; b=W48a7vybY9YRiHreJ801yX8uYEvpjzfRy6rKAZYjGENEnXLEEj0zpetthF/BNdFWSf we92+Gngfc6cQPyedFywF6EStgT1NLIyIapeXrDYl5/YEWdRWFKPjynv84X7IGihxyXo jeq7PhPfdvRORyCg96/5z5kgL574DVIuINIo6m6a2XoM4bh5Aj2HliBX/mtqDb0kdvx3 dYEjGfSNoV2OTdIsQWJ5hidPZef0h48G84hBxE8Ikk0l++lf+YH87feE30UmyUOqPssn o3JZYj1S9ie2eZ9MeJrcUmTDF8qBslyNSNuW37Faa+NsDUnYo1A38uwuLe+lhyhCoN+E oe9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=3u/4cbD1I8pAczbismccogm3dhTwZF0OtlB6RTL4L9E=; b=XfN2fbXQYU2g3KJrnNL14Ia8TWpdkJsq+cUgJGNJSdg/mLlcsHxTW0ZWpPzwC8NZFy wvr0uV9Lh1NP/fwXOf2w3Ie3lyJX08iYyKd4r8coYLb0dXAEpaHego8mxPk+EiLr/Y/4 c54pfUBMj+geYJeIPhU7bVg3erly0eC4T5enTxu6PfXdaCtQAmsN8lJe7UiUHM3BcdDF Q7XyiHDzR5OBsDrEioyGa5N0yI85ohrvDdviacKEqwGPnm+qVZ+38hj8xGyNQGi+pOgX 3w/IDfABuNeTMnIVOpfwZ02TlqoPrn1uq3RewLb9TTQCIpPsP0PPWl7vDI0bdX5OKLrM 148g== X-Gm-Message-State: AJIora//MeFkBMoAE2uG6RlToC8Cn7MDcPj+PArwjtTt//pmuMc/8lO6 HEXr0jlSOpP0Yvx6xZlT6YsaGVfq/LE= X-Google-Smtp-Source: AGRyM1uSwPy1i9hewpwf4tWOVbWHXH4hnAmTpc8B1Fb5PCSNaSXRKC6k0Q2V7U6yRztcPLQ8zsiK0A== X-Received: by 2002:a05:6000:1869:b0:211:7f25:89da with SMTP id d9-20020a056000186900b002117f2589damr5638990wri.696.1655222648559; Tue, 14 Jun 2022 09:04:08 -0700 (PDT) Received: from [192.168.0.22] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.googlemail.com with ESMTPSA id bh4-20020a05600005c400b002103bd9c5acsm12763771wrb.105.2022.06.14.09.04.07 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Jun 2022 09:04:07 -0700 (PDT) Message-ID: <189243dc-de13-8b4b-3eaa-d41f9358a310@gmail.com> Date: Tue, 14 Jun 2022 17:04:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Content-Language: en-GB To: internals@lists.php.net References: <2b35605f-8da8-46b1-aec3-00bd1bfe47fd@www.fastmail.com> <2347345.PIDvDuAF1L@arnaud-t490> <8422e11c-4a3f-9f99-56ce-884491dfe08e@gmail.com> <2680037.BjyWNHgNrj@arnaud-t490> In-Reply-To: <2680037.BjyWNHgNrj@arnaud-t490> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Short Closures 2, aka auto-capture take 3 From: rowan.collins@gmail.com (Rowan Tommins) (Sorry for double reply, hit send too soon) On 14/06/2022 12:18, Arnaud Le Blanc wrote: > Your example uses isset(), which is valid code in most circumstances, but as > you said it's not particularly good code. Do you have other examples that come > to mind ? There is plenty of code out there in the real world that is not particularly good, so I think it's a realistic example to think about. The question is, do we think the language can and should help people avoid that mistake? - Would the explicitness of "use(...)" make it more likely someone would spot it? - Would people be more likely to write "let $guest=..." (or whatever block-scope keyword we choose) than add "$guest = null;" at the beginning of the closure? I'm not totally sure, but we should always consider the impact on less-expert users, not just the power-users who are the ones often asking for new features. Regards, -- Rowan Tommins [IMSoP]