Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119413 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 40557 invoked from network); 24 Jan 2023 11:05:53 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Jan 2023 11:05:53 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9C7A6180544 for ; Tue, 24 Jan 2023 03:05:52 -0800 (PST) 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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS19151 66.111.4.0/24 X-Spam-Virus: No X-Envelope-From: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (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 ; Tue, 24 Jan 2023 03:05:51 -0800 (PST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id AB5A35C078D for ; Tue, 24 Jan 2023 06:05:50 -0500 (EST) Received: from imap44 ([10.202.2.94]) by compute1.internal (MEProxy); Tue, 24 Jan 2023 06:05:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ollie.codes; h= cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; t=1674558350; x=1674644750; bh=hI4fZs2hbR bNopfXa6mHWKzwoPnlVBm6dfiDVFnfSok=; b=Va4JTjpZXTnPN3Uj058cm9kHTq yDInva8iaxrSpRHv2p6ziP8aWDPfmL+UGxfl1IGe7U3PAo2tSF9HLRPNZCtJCidj NmrPWFUsNYyPIcuvLQ+QLpVaz/SIaKNYYC//lPAfzw2KeZeoZNJ8u/6naD/am6hN 3loEsvjEIIwSYQzsqKfqP0TH4yyDDVu+ii4+I0mUuUxF62G8Xg0cW0GQ+BK6QQKH eUbEOjJhaFdrHino1BTFJR5GxXMPJH1G8DcbNhPNZrlW7xPN9nX74Vl9WMYZw+rM Okr4FJoNac0Lw4RTqXcdPhldjp3RXtiyWJfnJpXNYoTyAxgoVVJL6oeza8TA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1674558350; x=1674644750; bh=hI4fZs2hbRbNopfXa6mHWKzwoPnl VBm6dfiDVFnfSok=; b=bTs5qgZ39r+/ILqpXCA6nSuh1pi85ajCDKAu2KJbg3F7 1ewyrDmazkwlQK5hNkPi2dYp6nRG5m/jAV4SVtAD1Fix0VhaBFbg+LXvPoH0Dxvq CJxCBQ+fmCob7Guguk3MJ8OY5zKJStUuakv8YlBnd+emP9v7Ent+FFydG1hnaIvg c6/1/ENZwHCMuhb43eeqMHFyf3Z7+bmVYpLnMAEl3USmkb2SPAIG546EA3rsmnae 0Yz0YZfhbn0e+IKbFB02PwJTD5QkoNjnltGSe6zvEfCcTuUknu145SXFScRLhhGd t/sYRjj240MINM8AeT0jvgJz/o5kNpOjIFYhpgDuAQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedruddvtddgvddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvufgtsegrtd erreerredtnecuhfhrohhmpedfqfhllhhivgcutfgvrggufdcuoehphhhpseholhhlihgv rdgtohguvghsqeenucggtffrrghtthgvrhhnpedvtdejgfetleeuleevkedvveeuudekfe fgheetueejvdduffejffdvuddvgeelueenucevlhhushhtvghrufhiiigvpedtnecurfgr rhgrmhepmhgrihhlfhhrohhmpehphhhpseholhhlihgvrdgtohguvghs X-ME-Proxy: Feedback-ID: i835c46d5:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 67E8D36A0073; Tue, 24 Jan 2023 06:05:50 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-85-gd6d859e0cf-fm-20230116.001-gd6d859e0 Mime-Version: 1.0 Message-ID: <87c1e01f-0ef0-4096-996c-030be1fab73f@app.fastmail.com> In-Reply-To: References: <8f530a4a-bf48-4259-877e-16ebf8082936@app.fastmail.com> <9c97b0b1-e17e-4eec-8cf5-fad86aca2da6@app.fastmail.com> Date: Tue, 24 Jan 2023 11:05:29 +0000 To: =?UTF-8?Q?Bj=C3=B6rn_Larsson?= Content-Type: multipart/alternative; boundary=735714a2508c449a8ac44937a0d388b8 Subject: Re: [PHP-DEV] Introduce the abiltiy to use the first-call-callable syntax on non-static methods, statically From: php@ollie.codes ("Ollie Read") --735714a2508c449a8ac44937a0d388b8 Content-Type: text/plain You're absolutely correct, the problem I was trying to solve was the ability to reference a method without throwing around magic strings, apologies if that wasn't clear. The whole idea, or rather, need/want for it came about because of time spent with Javas functional side, though I understand that's safer to do because of the way Java handles type safety. The ::class pseudo type is great for providing a classes FQN, and class-string is great for ensuring values are valid class strings when using static analysis, but we don't have anything for methods, outside of IDE completion. The solution wouldn't even need to generate a closure, TBH, it would generate something that could then be used in the same manner. Using the current features of PHP, I'd probably imagine something that does just about the same as this: $method = new ReflectionMethod(MyClass::class, 'method'); $collection->filter($method); Where the filter method does: foreach ($items as $item) { if ($method->invoke($item)) { // } } Although reflection doesn't have the overhead that everyone thinks it does, this is a less than ideal solution, but I think it accurately portrays what I'm looking for. --- Best Regards, *Ollie Read* --735714a2508c449a8ac44937a0d388b8--