Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120550 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 18718 invoked from network); 9 Jun 2023 05:59:48 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Jun 2023 05:59:48 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 33DF3180089 for ; Thu, 8 Jun 2023 22:59:47 -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=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS17378 206.123.64.0/18 X-Spam-Virus: No X-Envelope-From: Received: from mail1.25mail.st (mail1.25mail.st [206.123.115.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 8 Jun 2023 22:59:46 -0700 (PDT) Received: from smtpclient.apple (unknown [49.48.217.70]) by mail1.25mail.st (Postfix) with ESMTPSA id 61AA260412; Fri, 9 Jun 2023 05:59:41 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) In-Reply-To: Date: Fri, 9 Jun 2023 12:59:27 +0700 Cc: PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: References: To: Dan Ackroyd X-Mailer: Apple Mail (2.3731.600.7) Subject: Re: [PHP-DEV] RFC [Discussion]: Closure self-reference From: php-lists@koalephant.com (Stephen Reay) > On 4 Jun 2023, at 02:11, Dan Ackroyd wrote: >=20 > Hi internals, >=20 > I'm now opening the discussion for the Closure self-reference RFC: > https://wiki.php.net/rfc/closure_self_reference >=20 > This was previously discussed as a draft here: > https://externals.io/message/112216#112216 >=20 > Thank-you to KapitanOczywisty for the implementation. >=20 > cheers > Dan > Ack >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php >=20 Hi Dan, I quite like this idea, but, to (ab)use the analogy, the syntax bike = shed definitely needs a few more sample tins. The various syntax choices that introduce a new variable all seem like = they can easily lead to developer confusion about where each of the two = variables are actually defined and what is valid.. I can see plenty of = =E2=80=9C$closure =3D fn() as $closure =3D> =E2=80=A6.;` just because = people are unsure. Is there a syntax issue with e.g. `fn::self` / `function::self` for = this? I realise this is mostly just a variation on `Closure::current()` = but it =E2=80=9Cfeels=E2=80=9D a bit more natural, and has the added = benefit that it *could* be extended to return a closure of **any** = function, including regular named methods/functions etc in a later RFC, = if there=E2=80=99s demand for it. Cheers Stephen=20=