Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120528 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 35719 invoked from network); 5 Jun 2023 04:09:02 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 Jun 2023 04:09:02 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5B220180089 for ; Sun, 4 Jun 2023 21:09:00 -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-oo1-f49.google.com (mail-oo1-f49.google.com [209.85.161.49]) (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 ; Sun, 4 Jun 2023 21:08:59 -0700 (PDT) Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-55554c33bf3so3342621eaf.2 for ; Sun, 04 Jun 2023 21:08:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685938139; x=1688530139; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=fawjiBUBxRvjrXN9EO7oM0X4vfaEiQM+Gq6E3AGqlU8=; b=M6zAy467EgiB4TI1kbW4R+n2221RtHRuwNN7tnJyoC6a9afJC9Ul48C2861c+FHkuj /NoRJquwtT6zL+jYSlwrCKN3WMfVCcqf/Hbx7tEQrj4TRvywmmAoqSjsBvzB4W9655ue TocMSCKTSiEsQS+u2qh4WUVtZq6qRsO1r4ANfxLJ0R7wPxEvsVjp2T9/pZaBgb6CUG0b SyLCZeKIZhbL3Tp6wnXPbQu2X00E/HFV7K11hqccONGt2wu18WNBYpigJX4H2FvLFifH wE77SErWRY0EokTlmbiJEXzxj5uIBH8r93Rkz2WHfKwjR7ZHs3YGS6wi6elO+XyaMyBX K1bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685938139; x=1688530139; 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=fawjiBUBxRvjrXN9EO7oM0X4vfaEiQM+Gq6E3AGqlU8=; b=PKMz1UFzp5XpaiLjzzAWr8J2F/kfSxRvkfLOlK0VlVHmxLTGuacUx2338TOQL3IauM 0v7cYregh3e1Ng3/6SvwR0zjeE2bhb/ATomEvl/xy2uUzGXSrRIDDQtyWEYNtJO6ezLW YrYkhqozkyEqW9tImiPKuBkriXi49anSf9xdhKBW4rWwlg+1CU3xsb0LIpZdnQ/ZcN+Q YmxRRQuLoOKe7SbElhmV0U2I6w74nBjU9RycxjVKbzlb6P910qLBDDf4effVsSlmbGoz ltsiJ95mbL5LVOFiT0JOL4lfDfDwu/HrBLsaSGQZ2qiEQIOZHvf3TdsgqM6ZxnA162jA BUSA== X-Gm-Message-State: AC+VfDz+qU6pB1z8V7bkgf8QqloR2KoI70nQ9HHVdR4j0dNlfqavbulK /OuZ2z2ZU0tnYhjqGry5AdXzrsLeCGDeNiWXDG+rKTiVZRw= X-Google-Smtp-Source: ACHHUZ4jIFX/7HDx0KYtDmHBuUKNXg8qvooy/q5qz33GpKILpbZ81efcir0RGHomUXrTf7C8XC6JpB9BaJ4zvExdgdQ= X-Received: by 2002:a05:6358:7f13:b0:125:9172:2977 with SMTP id p19-20020a0563587f1300b0012591722977mr21619148rwn.2.1685938138761; Sun, 04 Jun 2023 21:08:58 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 5 Jun 2023 06:08:46 +0200 Message-ID: To: Dan Ackroyd Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000dfcd9a05fd5a0f5a" Subject: Re: [PHP-DEV] RFC [Discussion]: Closure self-reference From: drealecs@gmail.com (=?UTF-8?Q?Alexandru_P=C4=83tr=C4=83nescu?=) --000000000000dfcd9a05fd5a0f5a Content-Type: text/plain; charset="UTF-8" On Sat, Jun 3, 2023, 21:11 Dan Ackroyd wrote: > Hi internals, > > I'm now opening the discussion for the Closure self-reference RFC: > https://wiki.php.net/rfc/closure_self_reference > > This was previously discussed as a draft here: > https://externals.io/message/112216#112216 > > Thank-you to KapitanOczywisty for the implementation. > > Hi Dan, How about a keyword/variable to the current executing closure that works also if you refactor it to a function or a method. Just like self for a class we can have a keyword like fnself or a variable like $fnself that is automatically available inside the body. For a closure it would be the closure itself while for a function / method it can be even just a little syntactic sugar to functionName(...) / self::methodName(...) (not using polymorphism intentionally). Maybe we decide not to implement this right now for functions/methods but we can at least choose a name that has a wider meaning. As we are talking references, I think there should be a mention in the RFC about how GC will (not?) be impacted? Is the closure reference count incremented just when the Closure execution starts, with no impact on GC? Regards, Alex --000000000000dfcd9a05fd5a0f5a--