Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129443 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 2B5B01A00BC for ; Mon, 24 Nov 2025 19:11:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1764011519; bh=llKD7S2PX6B9PNeuv9M+GcaaIdquiTG8nO9Vhwv+pBE=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=L8KPwgTfJlGwLx/I5JaLVLQIYeKYklpyA1EJgJxEexyybwYl2PXRVLYsbtkACi2kT VpbWiWIyPLVyEH9wmFYkQLsZJAa7GEJMoPbAEfYK3z1H59sCYdSJ2qae/e+XJnq+Si Zs8fU7zDH026SdQ3tH2nonni0+HXT54sFKo2mH/4gDmvpFwgEA7/sRpr5Txqzgk7iM I687cPP7g8PuuYkB2SKl0cfoFQxMXaMjSJxRvcPLGjLfEGa3LNOHwUcPSy6ZS9oEmO suS0L1Z2V2QbBUW2jjutBc27ngZwx0/jgUtsmD9PJA8jjPbZ4VAfx2woF/+A5sgyXw tIPzZ18ZKs+cQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1A1991801DB for ; Mon, 24 Nov 2025 19:11:59 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from nebula.zort.net (nebula.zort.net [96.241.205.3]) (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, 24 Nov 2025 19:11:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=zort.net; s=zort; t=1764011503; bh=llKD7S2PX6B9PNeuv9M+GcaaIdquiTG8nO9Vhwv+pBE=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=ATiAUN0pBWS7LG2SX0KoicBmvYFz9Y795g2Zon491MysL5DsolJuCzCWyuMGRH84/ igbZz8FyYTsFC+MRVmPcLUWoMmLD4JWfvMTFc8TVE4Yrg3PR7RIOPUuIKsk9u0PK5g V7NcqU+d46VasLeF4XKQGqNT/srXmL3TwqQpo+nA= Received: from smtpclient.apple (unknown [49.226.237.227]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by nebula.zort.net (Postfix) with ESMTPSA id 2AAEB1300531; Mon, 24 Nov 2025 14:11:41 -0500 (EST) Content-Type: text/plain; charset=us-ascii Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81.1.3\)) Subject: Re: [PHP-DEV] [VOTE] True Async RFC 1.6 In-Reply-To: <65869feb-d518-4de3-8c10-115e3ba7dce7@rwec.co.uk> Date: Tue, 25 Nov 2025 08:11:27 +1300 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <21B9B538-50DB-4A00-A908-C52FA55849FE@zort.net> References: <2015208655.784984.1763811978476@email.ionos.de> <980296152.1071.1763813573083@email.ionos.de> <92865666.4510.1763818506332@email.ionos.de> <329450798.8037.1763822426377@email.ionos.de> <9287c46c-bc63-4dd0-9792-0f9421959589@rwec.co.uk> <65869feb-d518-4de3-8c10-115e3ba7dce7@rwec.co.uk> To: "Rowan Tommins [IMSoP]" X-Mailer: Apple Mail (2.3826.700.81.1.3) From: jbafford@zort.net (John Bafford) Hi Rowan, > On Nov 25, 2025, at 02:57, Rowan Tommins [IMSoP] = wrote: >=20 > On 24/11/2025 13:20, Edmond Dantes wrote: >> This makes it impossible to accidentally shoot yourself in the foot. = A >> developer can still do something silly by explicitly passing objects >> between coroutines, but now they are doing it consciously. >=20 >=20 > Again, you completely avoided my question, and went back to ambiguous = statements about "a developer". >=20 > To stick to my personas: >=20 > - SDK Susie does not know what implementation of LoggerInterface will = be passed to her library. How does she know if it is safe to use in her = asynchronous code? >=20 > - Legacy Les is using a LoggerInterface implementation written years = ago. How does he know whether it is acceptable for use with Susie's = library? I would argue that LoggerInterface only accounts for a synchronous = implementation. It is impossible for an asynchronous implementation to = meet the requirements of the interface. An AsyncLoggerInterface would be required. However, any synchronous = implementation that otherwise matches the requirements would implicitly = match. (Any non-asynchronous function is effectively the same as an = asynchronous function that has no suspension points.) Effectively, we would need something like: ``` interface LoggerInterface extends AsyncLoggerInterface { public function log($level, $message, array $context =3D []); ... } interface AsyncLogerInterface { public function log($level, $message, array $context =3D []) = async; ... } ``` So if SDK Susie can certify that _their_ library will work correctly = with an async logger, then they can indicate that by accepting an = AsyncLoggerInterface (in place of, or separately from, a = LoggerInterface). This is just an assertion that SDK Susie's library = will work correctly in the face of an async logger. It's up to Async = Alice and Beginner Bob to make sure they don't somehow footgun = themselves with their own (new) async code. Legacy Les isn't passing in = anything async, so as long as Susie's SDK doesn't violate its prior = synchronous contract, Les shouldn't have anything to worry about. -John