Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129450 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 0EA951A00BC for ; Tue, 25 Nov 2025 10:33:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1764066822; bh=aphos+YOABR7NBH/00jo80CwJ+G71fQG7v90lTJS9kU=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=fxauX3ZgWtgs9ZufL5gNpfyVyXHfHc9KEeS7g6GuFTd5kY6HQdF1sRk4pI+btpgOS c/Cvllk+kpTmkJfme4KiKIsItIA7cP/DS8H1sujdu2i/XMQDL39Ua73XoRMYnfHIXm XnUoSalriuk4x9e91b168TuqcWnIoUJZtJf/mJcVIHSimFw4TGWs+yK4O9zqnF8Ihi ns8Xc3Mv1BgRNLnUnVBkfUndErrLPeTPua9u0VGsEevf4wgcE1BK73S5/fYI5ScTyz a1ywePtdIS7MP0C3LKBhUY6uqBJeXKIO4Z80uPrFHsW0pozu1Q4rUA6ScaVJVxoA/C uSiTfV0/wkGxQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8204F180072 for ; Tue, 25 Nov 2025 10:33:41 +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=-1.4 required=5.0 tests=BAYES_05,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-a6-smtp.messagingengine.com (fout-a6-smtp.messagingengine.com [103.168.172.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 ; Tue, 25 Nov 2025 10:33:41 +0000 (UTC) Received: from phl-compute-12.internal (phl-compute-12.internal [10.202.2.52]) by mailfout.phl.internal (Postfix) with ESMTP id E303CEC03E7; Tue, 25 Nov 2025 05:33:35 -0500 (EST) Received: from phl-imap-05 ([10.202.2.95]) by phl-compute-12.internal (MEProxy); Tue, 25 Nov 2025 05:33:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc: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=fm1; t=1764066815; x= 1764153215; bh=UTXthHOQHicmcbB/xJ8mrTXWQ/d8whX+ga76oi7GN2Q=; b=F bKvaLLoup0UBcuRvmZpryM9xGF2FRD1jAL8fghf7XNPZK59Gw5CLNyxeninrGOIw E7YezgooiYb9M3eQ1uIVAoN4JanGSvR0wWw+81oOA/JsGjXZoo3mrTpAujsJOP7c SAUPKmcjUTaZMgCifNOKYo+3mo+efIerqc193A2CO1Lis3YofI8aimHmGgdDhpGz rGufWcQT9eMLjSgj7Z6PzBLyHg7QTffvp0B12pu2RQ1aLjX/gPXyldiwls0PK2oh XUIMfNLYIVtZWN1KFVFJUxKLFw92YrsQemLCYNY5sQRa0Xj4Nx6Z7bwfTg2enbWm qh3PmCQ4IT5TjYb7u0zdA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=fm3; t= 1764066815; x=1764153215; bh=UTXthHOQHicmcbB/xJ8mrTXWQ/d8whX+ga7 6oi7GN2Q=; b=0AyAm4nBryaPKz0Qhfo4Dk6/lidj+HjoVkN1qytH5Ny2iRuNSo1 9v+WFdZW2QMu1j/LlGqp308SlqRAioKxkOmagaXai67jd2Bt7uUrjS6wZKRXYfUE JYohvyDzZvYHvTUoxX/ZOeN+QBP/A3jg/cGVkqPFaQ75v5XiVvQ7JmD0p1e3jp/O wPkmjW+cvNjMR7a6OoORKOCkiiuDLZonj4tgAxV/XexVrOFI/7nqY9sGPY5F4EHX l/NZMD0D9N3lotkpw71UDTqodlMjjgDsUPPqgkE4gOU0zvMFCYOkDM1FpJJa9JoT WguITepcFkNlf8eIMD+APiRKrJLNm4x7LDw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvgeduvdegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvfevkfgjfhfutgesrgdtreerredtjeenucfhrhhomhepfdftohgsucfn rghnuggvrhhsfdcuoehrohgssegsohhtthhlvggurdgtohguvghsqeenucggtffrrghtth gvrhhnpeeiueethedvvdefjefhgfeiheelheehtdfhfeekjefflefgvedvkeduteejjedt tdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehroh gssegsohhtthhlvggurdgtohguvghspdhnsggprhgtphhtthhopeefpdhmohguvgepshhm thhpohhuthdprhgtphhtthhopegvughmohhnugdrhhhtsehgmhgrihhlrdgtohhmpdhrtg hpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvthdprhgtphhtthho pehimhhsohhprdhphhhpsehrfigvtgdrtghordhukh X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 3F4B51820074; Tue, 25 Nov 2025 05:33:35 -0500 (EST) 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: AT1NG5bj5VEw Date: Tue, 25 Nov 2025 11:33:14 +0100 To: "Edmond Dantes" , "Rowan Tommins [IMSoP]" Cc: internals@lists.php.net Message-ID: In-Reply-To: References: <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> <55149f3e-7ec7-4479-bd6d-2e7fe1b8edef@rwec.co.uk> <19693420-c091-49b7-b557-e09717239d9b@rwec.co.uk> Subject: Re: [PHP-DEV] [VOTE] True Async RFC 1.6 Content-Type: multipart/alternative; boundary=f8f67c73596641438776e6f0e2177e73 From: rob@bottled.codes ("Rob Landers") --f8f67c73596641438776e6f0e2177e73 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Tue, Nov 25, 2025, at 10:40, Edmond Dantes wrote: > Hello >=20 > > Susie doesn't know anything about the implementation, other than wha= t is defined in the interface. That is literally the purpose of acceptin= g an interface. > > So it sounds like her only safe option is to restrict her usage of a= sync coroutines to small self-contained pieces of code, and only use inj= ected dependencies and callbacks in the "main" coroutine where they were= passed in. >=20 > Exactly. This means that for asynchronous logging, a separate > interface must be introduced in order to guarantee correct behavior. If we're going to have to recreate some of the most basic interfaces to = get async to work ... does it make sense to seriously consider coloured = functions? As annoying as it would be to refactor so much code, I think = we could realistically provide ourselves escape hatches by not requiring= every function calling `await` to be async? // non-async functions can still call await, but this just forces a bloc= king call to the async function function i_call_await(): string { return await someAsyncFunction(); // spawns and blocks until a corouti= ne completes } // returns Coroutine -- since we don't have generics async function someAsyncFunction(): string { return file_get_contents_async('some_file'); // does not block but ret= urns a coroutine since the function is async } // alternative implementation that technically returns CompletedCoroutin= e async function someAsyncFunction(): string { return await file_get_contents_async('some_file'); // spawns and block= s until a coroutine completes } Just a thought and would mostly just be sugar around the proposed RFC. =E2=80=94 Rob --f8f67c73596641438776e6f0e2177e73 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Tue, Nov = 25, 2025, at 10:40, Edmond Dantes wrote:
Hello

> Susie does= n't know anything about the implementation, other than what is defined i= n the interface. That is literally the purpose of accepting an interface= .
> So it sounds like her only safe option is to restrict h= er usage of async coroutines to small self-contained pieces of code, and= only use injected dependencies and callbacks in the "main" coroutine wh= ere they were passed in.

Exactly. This means th= at for asynchronous logging, a separate
interface must be intr= oduced in order to guarantee correct behavior.

If we're going to have to recreate some of the most bas= ic interfaces to get async to work ... does it make sense to seriously c= onsider coloured functions? As annoying as it would be to refactor so mu= ch code, I think we could realistically provide ourselves escape hatches= by not requiring every function calling `await` to be async?
=
// non-async functions can still call await, but this jus= t forces a blocking call to the async function
function i_call= _await(): string {
  return await someAsyncFunction(); //= spawns and blocks until a coroutine completes
}
// returns Coroutine<string> -- since we don't have ge= nerics
async function someAsyncFunction(): string {
=   return file_get_contents_async('some_file'); // does not block bu= t returns a coroutine since the function is async
}
=
// alternative implementation that technically returns Co= mpletedCoroutine<string>
async function someAsyncFunctio= n(): string {
  return await file_get_contents_async('som= e_file'); // spawns and blocks until a coroutine completes
}

Just a thought and would mostly just be sugar ar= ound the proposed RFC.

= =E2=80=94 Rob
--f8f67c73596641438776e6f0e2177e73--