Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114250 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 33718 invoked from network); 29 Apr 2021 09:44:43 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Apr 2021 09:44:43 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 108161804E3 for ; Thu, 29 Apr 2021 02:49:29 -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,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 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 (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 29 Apr 2021 02:49:28 -0700 (PDT) Received: by mail-wr1-f43.google.com with SMTP id h4so57152304wrt.12 for ; Thu, 29 Apr 2021 02:49:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=q/zKUeBHN17qUCgJCUmYxLCGIO6QHld4k3I/LdxtCzU=; b=Duyhpb/nPJBGIG96uoolq40CTN85OmNixHl5D1SDJ+jDlRgfzhl9+gK4TsKy1a3isA 33zPFljpKueULuPSTpAsgPchkAsWoqZFNee2fEltW3Ff70D/UIyCDCWb0K0GRZ+BpAsr VuZddUQ4Mc0XcwEeYzQQ9UwsNN75kYQ1RUTRhRexXnblsUBhteAE1bHAtVUjrUVt6I70 uxjUg7GpO1d7RvesOLcl2WBcwDvMCvybwfe5eT44l6t/4YLUiyMkRqXXcmy8URT/yjJ/ Ujn5BeIVd95pyICC/RM/K9CR+7/Fz9C6CHzYNSGKHE/QSwZpM+EfM5+RhqgZbHA/nZam j1Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=q/zKUeBHN17qUCgJCUmYxLCGIO6QHld4k3I/LdxtCzU=; b=cgVur5xv1/T43jos/BG7Q6+OTnIaeAxjhmVcl8Spd2Wch1oJiCYpBBHiKGcI1F2dhA r9aZoXeQHr012cSkgMuZ/tc5MAFcNUDJNh9YECyYN2URIFDy/0wSgid6hPvJIXoQPcCu ngAf5/IaMwj9Cjv/RUw3VaMRs7ApE87hmXRKQrWBAumuZ1ughkGp1x3eeqyCJilEk8F7 8eF0yqJx+DsKV1JbZ3TIZLDgyO8fMBznDWxlyMDWB/QWwBPjMj1iQ77IDyI19ZCu+dX1 o+EeRyFj6p3pXtjHak0UdxtazSfG5KoZ34sIuq4WOVIIcrtXtXz6e8TDyzY1WGTEqZ8E A1SA== X-Gm-Message-State: AOAM5335woJlYNwKtfiaZDN8CVfpJEHwFn+R2fwNWzO+uaqgXdF1kuUy FCk11XoqwaskRR+UADo3n6OS06pFuR4= X-Google-Smtp-Source: ABdhPJzCfeo/yZNdfS+b3ldLuKssafUgL+7z7Ltbnj4Ie7uKQJMLBwPkcCucyrTc+5c1cWtk3snq7g== X-Received: by 2002:a05:6000:1a85:: with SMTP id f5mr28097613wry.213.1619689767252; Thu, 29 Apr 2021 02:49:27 -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 l13sm9713586wmj.3.2021.04.29.02.49.26 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Apr 2021 02:49:26 -0700 (PDT) To: internals@lists.php.net References: <88c9eb5f-f80c-4869-b7f8-1b58b9e2eaa3@www.fastmail.com> <85D2BF1C-167F-4D0A-86FD-2ECAC5956192@cschneid.com> Message-ID: <0e17bee2-cd4b-48b4-2f51-82095faff4f9@gmail.com> Date: Thu, 29 Apr 2021 10:49:25 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <85D2BF1C-167F-4D0A-86FD-2ECAC5956192@cschneid.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Subject: Re: [PHP-DEV] [RFC] Auto-capture multi-line closures and short functions take 2 From: rowan.collins@gmail.com (Rowan Tommins) On 29/04/2021 10:25, Christian Schneider wrote: >> Without a keyword like "var" to declare it, I think most users would assume that an initialisation like "$foo=null;" at the top of their closure would make a variable local. > This assumption by the users would be true as we are capturing by value, not by reference. Not entirely. As currently implemented, the value would still be captured, and so use memory, prevent destructors firing, etc. Compare 3v4l.org/Utd9j vs 3v4l.org/fpjbX Regards, -- Rowan Tommins [IMSoP]