Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118179 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 46577 invoked from network); 4 Jul 2022 15:22:42 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 Jul 2022 15:22:42 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B4C43180212 for ; Mon, 4 Jul 2022 10:15:15 -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, 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-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 ; Mon, 4 Jul 2022 10:15:15 -0700 (PDT) Received: by mail-wr1-f45.google.com with SMTP id s1so14317074wra.9 for ; Mon, 04 Jul 2022 10:15:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1+AR5MgoH+UpuBReDl09mCgZRZgeQPDQTbGfeg6Qgyk=; b=RToZxLp4hbq6bDDCxQZ3cVdJls7dNRSk4GwF1cditBuEb7MEm9j0Lu6UNHufMqU7CR BYu5CBXKt/tZOMLvqOZuEAJ7W/v08L+fPPSSXjOpqm6N/tfn8nFIZxL8GVh0T+S1YzCj XbnjDb6gst+iNuAw4KMHVEOvfDJ2Z1hKPN0isaDxL9C1E6tBv3pVwlL/K1YwmlzIgrdq HpA7ALoCV2eHhlRzcj2R8A13aPa+SBb7LxNO2Y5/a5qWCfvo6UTdxa3nhUf5v7mQFl9a VqOVxvoxB5GU4kOoIFoX7dF6QgIMXpBJ9fj9JT/XVadzmy2x2zuKnrnaH1ldsD6QZ8tt 1Vdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1+AR5MgoH+UpuBReDl09mCgZRZgeQPDQTbGfeg6Qgyk=; b=x7GePjHEvvSChuLM6ged9ocTrm01wa8qK244aulZ+qIRV/uiJlGqUYnsSGtoSpoWKz jhB0w3NrvwA6f3qiV4TL8YZpIC9DRuZZRpQMxtfZ597ItYkeeBVouxrD6ywiobeG7AP4 hJ4CFu9dULMoGHv4KZYyQTq9b+BzNmM/tqDDBRaG9XPil6aurMuht25jJD0hy7qx5/HU vfXXBGg+wGXK+LaUhYB2EJthztJIvENBNHKktgILwWrgnzMhn2wj0I0P85jV5Yxf98Pb I75sT3uag5zrwrWXfNUWxulZNBRFfw995GAAGs8edhy2lyedFLmElBRVmjccVG5d97Ys DUnQ== X-Gm-Message-State: AJIora9nYNIR8SnEB0SxzJUuxEf0SLexoVrTDBDx3L+JxF77rB+Qi2d6 YzvPJspehcHqaUhgPJZnbAI= X-Google-Smtp-Source: AGRyM1tQ+vwK1+SlQMwoJgsLQP+Dq7ZiqG/aZWyCrbJ7UiSFfRaQQa0p4P7mv9l5v/JNz6MiOB9nCA== X-Received: by 2002:a05:6000:381:b0:21b:9a20:7edb with SMTP id u1-20020a056000038100b0021b9a207edbmr29677646wrf.71.1656954913901; Mon, 04 Jul 2022 10:15:13 -0700 (PDT) Received: from arnaud-t490.localnet (2a01cb04054b5b00ec5ab0d7751f311a.ipv6.abo.wanadoo.fr. [2a01:cb04:54b:5b00:ec5a:b0d7:751f:311a]) by smtp.gmail.com with ESMTPSA id r7-20020a5d4947000000b0021d221daccfsm237882wrs.78.2022.07.04.10.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 10:15:13 -0700 (PDT) To: Larry Garfield , internals@lists.php.net Cc: php internals , Marco Pivetta Date: Mon, 04 Jul 2022 19:15:12 +0200 Message-ID: <6128711.lOV4Wx5bFT@arnaud-t490> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [PHP-DEV] [RFC][Vote] Auto-capture closures From: arnaud.lb@gmail.com (Arnaud Le Blanc) Hi, On lundi 4 juillet 2022 12:04:59 CEST Marco Pivetta wrote: > I ended up voting NO due to the fact that there is no mention of `$this` > behavior changes ( https://externals.io/message/117888#117889 ) : I also > disagree with NikiC's stance on this being the same construct as before ( > https://externals.io/message/117888#117897 ), so I really wanted to get rid > of this constant memleak risk that we have in closures. I should have made > my stance stronger, instead of letting the discussion thread die, but time > is what it is. Forgot to add this in Future Scope, sorry. The RFC does NOT change the behavior of `$this`, so as to keep it small. This is something I personally want, but it can be done after this RFC, and the change could be applied to all function kinds. > Unclear (to me) after looking at > https://gist.github.com/arnaud-lb/d9adfbf786ce9e37c7157b0f9c8d8e13, is > whether the optimizations are applied at compile time. It looks like the > changes are inside the `Zend/Optimizer/`, and `zend_compile.c`, so perhaps > the benchmarks are probably just worded in a confusing way. Sorry for the confusion. I confirm that the optimizations are applied at compile time. The benchmarks measure the runtime effect of these optimizations. > Important to note how `Zend/zend_compile.c` now depends on `Optimizer/`, > which is a potential design issue. The Optimizer was moved to `Zend/Optimizer` earlier so that in the long term it could be used by the compiler pipeline directly (rather than as part of caching). There are clear benefits in reusing the Optimizer here. Duplicating or reimplementing live variable analysis would increase maintenance cost, whereas by reusing the Optimizer's implementation we take profit of a fast and well tested implementation. Greets,