Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130487 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 75AFA1A00BC for ; Mon, 30 Mar 2026 07:58:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1774857511; bh=9PxTURKifedVYz7s7dh15N2Gr8W5sz6l7E9SdvsWk7Y=; h=Date:From:To:In-Reply-To:References:Subject:From; b=O3WswVhhlIbY6phCMz6uPfy1uDooFiblEE20n5+Vb578/4Vd9jnHafJEKltg9l1qC uZ0ovNajHo0krslPOaAGJq/fsbsM+/ronFkXsuxJxcyzoZ8dQu2W9IJCFkGVUngCZM Br8pSTweu0Rmenv0foWBCuA57XQeX8ztBi65oxb+VnaZvpJiIfQOUiyCvDSPGQpVo5 Wleao3fF0/nC7ac9MUGkKsx5xUyEYIgKwE/ajCjjqlh3vckan3tO7+xuTXkw5une0d 7GFoW5ZE0aXVDzkeiTaSeOM/xB3YHxCW/mjbOhL9i5dMLOcOVoBeZla27+idNgf+pd 25Te2UtELF8YA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 35B1C1804BE for ; Mon, 30 Mar 2026 07:58:31 +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,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fout-b2-smtp.messagingengine.com (fout-b2-smtp.messagingengine.com [202.12.124.145]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 30 Mar 2026 07:58:30 +0000 (UTC) Received: from phl-compute-12.internal (phl-compute-12.internal [10.202.2.52]) by mailfout.stl.internal (Postfix) with ESMTP id 24EC71D00295 for ; Mon, 30 Mar 2026 03:58:25 -0400 (EDT) Received: from phl-imap-05 ([10.202.2.95]) by phl-compute-12.internal (MEProxy); Mon, 30 Mar 2026 03:58:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc: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=fm2; t=1774857504; x=1774943904; bh=9PxTURKife dVYz7s7dh15N2Gr8W5sz6l7E9SdvsWk7Y=; b=Z8bTMxqqwOOn/DcDToWULh07VT /BvtJXqPchbUueHw5+FfpnWiHmii8/8lJg2h9XFRuSJ8NidtUoscuDza1AadCtFy uAHkjlrq+0kyBxB749Yed0ivFC8wInFvXMHtGpK//Jaqnm4fSAI+HGZOjto3f5Nj n8CliobFSzJ2xir1f8+QtvRT96KM/kGE4RE8QShttrGdcEbqxe/+KXHuT+FkOY0h PDjsUe0qNE1WZXJpA47erfSqLz71AXliNRK9ggvML94iEPUHarWv28lTkk8h8N3m 5s9bgA9Bc3I6XsLSNKvUDKksbiNZ/G7ASWZmqSMWXDLKuaB0uwPB+RUUJ1aQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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= 1774857504; x=1774943904; bh=9PxTURKifedVYz7s7dh15N2Gr8W5sz6l7E9 SdvsWk7Y=; b=duUxujvegEjiKRH/O8tEKbrEJjGbXWke7AXpNJaBVE2wCe6+/tO /qKKiCCzcziWo0xlneVrkc/1meeV9aFU8DcBF6ATc6RRm8AmbGCf4v8BfAylJ3NM tglMxQZC2mq2QmZzF/0ufd7VHX+dQJXQEK4V3Ic7s3P+oLv30GxQX2fZIJ261Xdb WPZP/ZmTM1tMuoXZoGKezYZfIht1eB+AvUwOFuCk/VvCgphMdoQw2ZPhzV5NWn+r P/pkw9Lrx83MWedv1f6dIhkjDbHV58loQ/Rxp7AkenvpXfM2rAUG3r5FhjP2wYAL 70NDywvo/KcxDjOhRA+8FcHpKPDZMxrnaGQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdeffeekgeegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefoggffhffvkfgjfhfutgesrgdtreerre dtjeenucfhrhhomhepfdftohgsucfnrghnuggvrhhsfdcuoehrohgssegsohhtthhlvggu rdgtohguvghsqeenucggtffrrghtthgvrhhnpedtueejtdethfeulefhtdelieduteelff dtudelheffgedtieehhfelieejgfevgeenucevlhhushhtvghrufhiiigvpedtnecurfgr rhgrmhepmhgrihhlfhhrohhmpehrohgssegsohhtthhlvggurdgtohguvghspdhnsggprh gtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehinhhtvghrnhgr lhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 83977182007A; Mon, 30 Mar 2026 03:58:24 -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: AOYV16MnzJe3 Date: Mon, 30 Mar 2026 09:58:03 +0200 To: internals@lists.php.net Message-ID: <14db1f02-c6f1-424f-b6a6-4b880ac18f4d@app.fastmail.com> In-Reply-To: <9018E616-F5BA-4E94-B2B0-1513A2365286@rwec.co.uk> References: <5ce1f5a3-1ad5-4cc7-8c6e-93170af28ef4@sandfox.me> <9018E616-F5BA-4E94-B2B0-1513A2365286@rwec.co.uk> Subject: Re: [PHP-DEV] RFC proposal: Invokable interface Content-Type: multipart/alternative; boundary=8b2bffe096a84b5784a9bee9aa2e5252 From: rob@bottled.codes ("Rob Landers") --8b2bffe096a84b5784a9bee9aa2e5252 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Mon, Mar 30, 2026, at 09:37, Rowan Tommins [IMSoP] wrote: > On 30 March 2026 01:32:24 BST, Osama Aldemeery w= rote: >=20 > >The only difference is that __toString() has a fixed signature, so > >Stringable can enforce it through a normal interface declaration. > >__invoke() doesn't > >have a fixed signature, so Invokable uses an enforcement handler inst= ead. > >Different mechanism, same contract. The difference is caused by the > >variable signature, not by any fundamental difference in what the int= erface > >represents. >=20 > I think that is a very fundamental difference. >=20 > Given $foo instanceof Stringable, the user knows they can write (strin= g)$foo and the object will do something - that's already a pretty weak c= ontract, in my eyes, but it is a contract. >=20 > Given $foo instanceof Invokable, the user knows even less. They know t= hey can invoke the object somehow, but there's a fair chance that $foo()= will fail because of mandatory parameters. >=20 > Can you give an example where this very loose contract would be useful? >=20 > Regards, >=20 > Rowan Tommins > [IMSoP] I'd prefer if the interface forced an empty argument set. You can add ar= guments so long as they're optional. But generally speaking, there is no= need for arguments on an invokable class -- that is what constructors a= nd properties are for. =E2=80=94 Rob --8b2bffe096a84b5784a9bee9aa2e5252 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Mon, Mar = 30, 2026, at 09:37, Rowan Tommins [IMSoP] wrote:
On 30 March 2026 01:32:24 BST, Osama Al= demeery <aldemeery@gmail.com> wrote: