Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116292 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 30083 invoked from network); 22 Oct 2021 12:30:47 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 22 Oct 2021 12:30:47 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 02CA5180381 for ; Fri, 22 Oct 2021 06:19:30 -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_H2,SPF_HELO_NONE,SPF_PASS 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-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (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 ; Fri, 22 Oct 2021 06:19:26 -0700 (PDT) Received: by mail-ed1-f54.google.com with SMTP id 5so2351837edw.7 for ; Fri, 22 Oct 2021 06:19:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=nEGRoJQQa9rtuFc2tvoL+3AD+dJBbT1vqQwA4XqI0Tw=; b=qyd6Qw6JPOqGUFnzMl4XBtU7BDab9HXFkiN4PExvWmw8MB5qx4sEQZxaHvSUJ7FNqt miUEQwZXc6HvwlyMPe2P1XZpEtIconnr2re1SOxmtRiCT3SCPvTKmo+iEWbslOVBBL26 o5Hq1SOefZN/JCkfiW96xZb3gfq+q9Sy8DhUqraLsgHu6+aHAkqaw94LN+7XCYrr3655 Kbm3D8TNuyyKx754U6fKhDApWvsqqmcjgioJ1PUQ+OCQdnOY+XjmK1uGcnA8+u4dSLEy TuCkxBk8zsGb9GmcebRzCmHob7cuaLwu6Cbd+QnWBdK8MSsNwYpR4yBrD2sjpXf4n0LN +HiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=nEGRoJQQa9rtuFc2tvoL+3AD+dJBbT1vqQwA4XqI0Tw=; b=ccX+7+7vnnh3r99liC29AsIMjSJ3qBjdAweE47rWAJu6mRc+LnYJ6r1fYxkbMwyglS jYn9BqjXR6pG5T5adlgu6dZ4QJHKPmUo6+7WCU2ZKSDcvUT/2FF5lT57teAflD/K2fs0 FpTxDHqdd2tZ16ynarybrqTFCj8LeYhh3Zt7rynhE/Ivl66ghbbOiNVtxadtjAzVgp74 hFb9MhSqgR9jqD/fkELsVPYOzovWh8wKuv5v0L9VyZKszHd5ph5L4w6pTmFNW4SEbWlY YH5TZ1HUhU+31K5CMa8cNxn91bw21QNvrG8oV3AiQQW+Ow/NukffCgnbHpWjjhS14y/i AhAg== X-Gm-Message-State: AOAM531yW813UtssWn7KjQJ8D3Y5OyQ7R1MZmjtmFLtVJX5dE0uTxnOo y+xbBrM9OZ8+vb3Vx6Ob4un425t+yeQ= X-Google-Smtp-Source: ABdhPJyVMDnc9kwjMIuMwJ0KCvsVQz93ezcqBJPk8fmKcIsxo8YLUuoLP/eKqPnsfj90pURTdU0HMg== X-Received: by 2002:a05:6402:11cb:: with SMTP id j11mr17280211edw.124.1634908765360; Fri, 22 Oct 2021 06:19:25 -0700 (PDT) Received: from claude.fritz.box ([89.249.45.14]) by smtp.gmail.com with ESMTPSA id sh36sm1307362ejc.88.2021.10.22.06.19.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Oct 2021 06:19:24 -0700 (PDT) Message-ID: Content-Type: multipart/alternative; boundary="Apple-Mail=_BB1F02B3-4BBE-4CDC-ABBF-C4B2537CE476" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Date: Fri, 22 Oct 2021 15:19:23 +0200 In-Reply-To: <17c9ff9e9da.10b3e7f1c1280030.5141627710284677362@pmmp.io> Cc: internals To: "Dylan K. Taylor" References: <17c9ff9e9da.10b3e7f1c1280030.5141627710284677362@pmmp.io> X-Mailer: Apple Mail (2.3608.120.23.2.7) Subject: Re: [PHP-DEV] Add ReflectionFunctionAbstract::isAnonymous() From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_BB1F02B3-4BBE-4CDC-ABBF-C4B2537CE476 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Le 21 oct. 2021 =C3=A0 01:12, Dylan K. Taylor a = =C3=A9crit : >=20 > Hi all,=20 >=20 > Given the addition of Closure::fromCallable() and the upcoming = first-class callable syntax in 8.1, it seems slightly problematic that = there's no simple way to tell by reflection if a Closure refers to an = anonymous function or not. ReflectionFunctionAbstract::isClosure() = (perhaps somewhat misleadingly) returns whether the closure is literally = a \Closure instance, so it's not useful for this purpose.=20 >=20 > The only way to do this currently (that I know about) is to check if = the name of the function contains "{closure}", which is a bit unpleasant = and depends on undocumented behaviour.=20 >=20 > I'm proposing the addition of = ReflectionFunctionAbstract::isAnonymous(), which would fill this use = case, and may be able to offer an implementation.=20 >=20 > Thanks,=20 > Dylan Taylor.=20 >=20 >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php >=20 Hi, Per the manual [1], Closure::fromCallable() =E2=80=9Ccreates and returns = a new anonymous function=E2=80=9D. I guess that this might not match = your notion of =E2=80=9Canonymous function=E2=80=9D? Therefore, I am asking for clarification: What practical distinction do = you make between =E2=80=9Dan instance of Closure=E2=80=9D and =E2=80=9Can = anonymous function=E2=80=9D, and why does this distinction matter? [1]: https://www.php.net/manual/en/closure.fromcallable.php = =E2=80=94Claude= --Apple-Mail=_BB1F02B3-4BBE-4CDC-ABBF-C4B2537CE476--