Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130499 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id D90891ADAAA for ; Mon, 30 Mar 2026 18:37:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1774895879; bh=GrHYvkUO8TTTYFXPCDm43Z5wfqqkzcW7gL1DZrxOxzw=; h=Date:From:To:In-Reply-To:References:Subject:From; b=Tr0d0IM1HlVOOL4QAhwW2N552D5pOZQQoAXLlLr/1lqSm9+vMuHNqaiz0voeJTPaX tbYL3bWcNrr17xSl4gFdrdVLi894J9T4AszH336kz3tE/MRmi4pbfc75GtIY8EJ4l4 iGrIvCVBOEIeZ5ZLK5htuhr2ozDU8xCzAl3aLToYa8wBvEShI18SzHxLd4PlzI5Pp9 ReqIQDY930AJ9fFg3ZXGC+N66Pi/wTjlm95iy3Wg8uINeIlMpzPdOqLxdpBgbVchpO 4DxcLb6X27ddNpuO9o8HMV9u7WFX/EEspj85A9Ul2o0zVJsa51S/jJ9edWVRNFY0cJ h56A29nZsOP5w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 783351801D9 for ; Mon, 30 Mar 2026 18:37:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fout-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 30 Mar 2026 18:37:55 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id 4FC891D0019D for ; Mon, 30 Mar 2026 14:37:50 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-04.internal (MEProxy); Mon, 30 Mar 2026 14:37:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm1; t=1774895870; x=1774982270; bh=PIRKIAb+cZ8T4yL72TjIy /PY4SVQDWlyCVGJCK4fGhU=; b=AKQvgVdHEarkOVL1ABf5FtmKNklIWG8Ay3PVl e5o+SE5VRg+exVnl2kgrJ54VuriadT9erNfchPMBYMLhty9IBjrhX9KWrQDmVdXs UTU3aGnDyU+S5giJ0PHYPelfXQvQfZvxNCCW/NjXzT3jqKSHsTf04sRZdPdZ6a9O a3R1nklCf9pg3oci7HoxahtzdZnzvbADW+5Eqy2pOGCH3ZmumazrK9oWdayFYJ1G peqXaPa1qJUMurH5GbPPG204hTrComH1bzarPrhqaRiCWsIhwM3ARnPsvDUcTHBg u5aft6XdfX0pBVvGD0UcHV/K2aAelRTjGZvW8XWWHEXgRmonw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1774895870; x=1774982270; bh=P IRKIAb+cZ8T4yL72TjIy/PY4SVQDWlyCVGJCK4fGhU=; b=IXrJ8QUBgcXhbmljw tcmjCfrs1KBuUPqlzHuQNjrjsfQNNAM9Q2+XtHQY3FsMfcF601TzEu5zWstKCema lXZtj3bWh+wpK0rDXCulnHjKkXxLhkxzxDnAhG8rsIJBQ1z750DnSLO7wDvsez60 SCUeKQARSgS6oqkDO+NqPL25WjPmYrCIedExSDommELj9xxAen17/2J1CX0KGR16 d1NWE6IcQEm+SrSS14qcYYZYd/RLunuSdMTyxk8AAJSwJqklCebUAilv3c9hfL48 gdx0OTGKlelPHyq2M6YkdSaMROSAnSEOzWCHseZGm4B3MIaRCTPEYOIEsBwYhsaL PaP4w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdeffeeljedvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvffkjghfufgtgfesthejredtredttdenucfhrhhomhepfdfnrghrrhih ucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqe enucggtffrrghtthgvrhhnpeeuheejudelteelieehleelleekvddtgfettdeghffggeeh vdejgeejfeffuefhvdenucffohhmrghinhepghhithhhuhgsrdgtohhmnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhf ihgvlhguthgvtghhrdgtohhmpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpoh huthdprhgtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id DA0D970006B; Mon, 30 Mar 2026 14:37:49 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: Awq0XQ2J7sEw Date: Mon, 30 Mar 2026 13:37:28 -0500 To: "php internals" Message-ID: <52051dc2-ff84-4700-9d14-fb0e3065fb52@app.fastmail.com> In-Reply-To: References: <1774862880709.2052150140.1267250908@yahoo.de> Subject: Re: [PHP-DEV] RFC proposal: Invokable interface Content-Type: text/plain Content-Transfer-Encoding: 7bit From: larry@garfieldtech.com ("Larry Garfield") On Mon, Mar 30, 2026, at 6:21 AM, Rowan Tommins [IMSoP] wrote: > On 30 March 2026 10:51:22 BST, Hans Krentel wrote: >> >>When you spotted those, were they also with such a generic invocable interface as in this idea in their interface hierarchy? > > If they had any interfaces at all, I would expect them to be specific > to the use case. As I said earlier, I can't see how you would use an > interface that asserted just the existence of the method without any of > its signature. > > Regards, > > Rowan Tommins > [IMSoP] This has sort of come up in designing the compose operator that I've been working on, on-and-off. I'd want to allow Closure + Closure to return a closure, but also allow Invokable + Closure, Closure + Invokable, and Invokable + Invokable to return a closure. But right now there is no obvious way (to me at least) to detect an Invokable object and treat it accordingly. So that's where it might be useful to me, at least. However, that's an engine level check, not one that would make sense in user-space. In user space, I'm not entirely sure where you would want this and not *also* want a use-case-specific interface. I've done quite a bit of dynamic dispatch work lately, and is_callable() and method_exists('__invoke') have sufficed for what I need. As an older example: https://github.com/php-fig/event-dispatcher-util/blob/master/src/ParameterDeriverTrait.php I'm sure someone will argue it could be simplified with more modern assumptions, but for the sake of this thread, how would an Invokable interface make that code cleaner? --Larry Garfield