Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129432 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 91B221A00BC for ; Mon, 24 Nov 2025 13:56:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1763992592; bh=V890plEVdX16f/4TBSDOH+NT2W/BJBkqRO+Z1dXV5Yg=; h=Date:Subject:To:References:From:In-Reply-To:From; b=QXuqAzPqP9qCucAr+9BtL1BRxm228kDG85YlYe488VE6JX2yA8DYigPsBxNms5pph lHcSc2BRxnCPmN9YKtbh4Elrl0m14HRzD97F+RhVIdgN8a0ZwGydnOwpOzC83SPbec sXuVusjVktcoQxNKNmUkxsNdsHr7tPMzCot933JE9sNIYaBp01MRl7kCG75LrxGD+P MiqPwc+JDDBG4XHVZ4v0LhxPMyQ4Xnfxr4gBeHD6tnZmvTbhAzfDREEPSVSdmqBQzC W25tJlRq2ugB9xD9Kcd8spTXH/oxYPRRxEjVgLYhh1BPYAJ0Iw55FccFvzrwfCuiR1 J4Gg7e/eULD3Q== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 12BC818002E for ; Mon, 24 Nov 2025 13:56: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=-2.8 required=5.0 tests=BAYES_00,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-b1-smtp.messagingengine.com (fout-b1-smtp.messagingengine.com [202.12.124.144]) (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 13:56:30 +0000 (UTC) Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfout.stl.internal (Postfix) with ESMTP id E39681D000B2 for ; Mon, 24 Nov 2025 08:56:24 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Mon, 24 Nov 2025 08:56:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; 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=fm3; t=1763992584; x=1764078984; bh=FJDMjdsXnE fzuwbdPHnTdl7As2UFuREqFj7GqPgiD14=; b=e51ROHNUFL4PBXcpVReBBxCiIr 1RgPuaAYaqZyI/QK9Q1cMB3EYS9+sevUicid7zRx9e28CsRAQND4u8Ar75DWjkoi qDxg4XIr9YMCUqMauMhigNa5tKylUUzAFK/qD6bglbzS52vHyIBbr77YwkQchVDJ R9utML/8/i8mW5+zqrS7ZjKo6zq3etMR7DpqHD4Hss80xEDR2TKDax5qdTS37yuA 4Y8FdobQRKE8ZY8/HX+e4IQQGkI3C+m4wdpXmUdwofoiK/FB3dPjWt1j83EjIZ73 thx6serrS2gjF+z8I5bMuCe0V7aWZmIJyp+MxC4Jy8ukS6kBE+V7EHiaFCtg== 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=fm3; t= 1763992584; x=1764078984; bh=FJDMjdsXnEfzuwbdPHnTdl7As2UFuREqFj7 GqPgiD14=; b=rUSJmYKGaj7czCvbaTTU8pK5WdIyBFiopHA2IFPD3blMjw32WNu xzburXAj7Fdw3/ff94Y4facUML+mNHLJhaT/EvfXEVQjjNcpll3Qkq47HxGfoIJm Ce9kQFnRiU+v9pmlbcPDhe+Oq9EqIx4CKpJZw0QZwnyqAopQxeJQvMoKPrUOs3y6 0Xd0WMfixvAyzt11GAguroQMkJVl4ce8OQq2lriZlOyuPyKF4C29nrLoCocaCANL 96lM/j6C8iW9RiqH1VhO0GLmvS5gYZBDfivP7FK8L49fydDxDUvMS/bRKTvScYK9 WzYsfreRoj4hWezfqU5kGglTHXZngiRWpqw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvfeekjeejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpegtkfffgggfuffvfhfhjgesrgdtreertd dvjeenucfhrhhomhepfdftohifrghnucfvohhmmhhinhhsucglkffoufhorfgnfdcuoehi mhhsohhprdhphhhpsehrfigvtgdrtghordhukheqnecuggftrfgrthhtvghrnhepheetle eiiefgueduieeuieffvdevheduueefkeejuefgffeftdeitdegtedtleetnecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihhmshhophdrphhhph esrhifvggtrdgtohdruhhkpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Mon, 24 Nov 2025 08:56:24 -0500 (EST) Content-Type: multipart/alternative; boundary="------------NcxKpzCR3u6aZmg4nAQjBWVG" Message-ID: Date: Mon, 24 Nov 2025 13:56:23 +0000 Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [VOTE] True Async RFC 1.6 To: internals@lists.php.net References: <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> <751A13E5-79AC-47C2-AFC7-A3B0AD69CA71@rwec.co.uk> Content-Language: en-GB In-Reply-To: From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") This is a multi-part message in MIME format. --------------NcxKpzCR3u6aZmg4nAQjBWVG Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 24/11/2025 12:15, Bart Vanhoutte wrote: > > Will Legacy Les see a side effect when he upgrades to SDK Susie's > new async library? > > > For clarity, Susie's code has turned from something sync like: > > ``` > function getFoo(): Foo > { >   $resultOne = sendHttpRequest('one'); >   $resultTwo = sendHttpRequest('two'); > >   return new Foo($resultOne, $resultTwo); > } > ``` > > into something async like: > > ``` > function getFoo(): Foo > { >   $results = await Async\all([ >     spawn sendHttpRequest('one'), >     spawn sendHttpRequest('two') >   ]); > >   return new Foo($results[0], $results[1]); > } > > ``` > > Is that correct Rowan? It could be as simple as that, but it might also have Coroutine / Future objects held internally rather than immediately awaited, e.g. she might have changed this: ``` function getNextResult(): Result {     if ( $this->needNextPage() ) {         $this->currentPageOfResults = $this->fetchNextPage();     }     return array_shift($this->currentPageOfResults); } ``` To this: ``` function getNextResult(): Result {     if ( $this->needNextPage() ) {         $this->currentPageOfResults = await $this->nextPageFuture;         $this->nextPageFuture = spawn $this->fetchNextPage();     }     return array_shift($this->currentPageOfResults); } ``` There might also be interleaved code which is passed in from the application - i.e. code written by Beginner Bob or Legacy Les. For instance, an implementation of the PSR-3 LoggerInterface, which might be referenced inside the fetchNextPage() method which is being run asynchronously. [P.S. Reminder: place your reply _below_ an edited quote, not _above_.] -- Rowan Tommins [IMSoP] --------------NcxKpzCR3u6aZmg4nAQjBWVG Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
On 24/11/2025 12:15, Bart Vanhoutte wrote:
Will Legacy Les see a side effect when he upgrades to SDK Susie's new async library?

For clarity, Susie's code has turned from something sync like:

```
function getFoo(): Foo
{
  $resultOne = sendHttpRequest('one');
  $resultTwo = sendHttpRequest('two');

  return new Foo($resultOne, $resultTwo);
}
```

into something async like:

```
function getFoo(): Foo
{
  $results = await Async\all([
    spawn sendHttpRequest('one'),
    spawn sendHttpRequest('two')
  ]);

  return new Foo($results[0], $results[1]);
}

```
 
Is that correct Rowan?


It could be as simple as that, but it might also have Coroutine / Future objects held internally rather than immediately awaited, e.g. she might have changed this:

```
function getNextResult(): Result
{
    if ( $this->needNextPage() ) {
        $this->currentPageOfResults = $this->fetchNextPage();
    }
    return array_shift($this->currentPageOfResults);
}
```

To this:

```
function getNextResult(): Result
{
    if ( $this->needNextPage() ) {
        $this->currentPageOfResults = await $this->nextPageFuture;
        $this->nextPageFuture = spawn $this->fetchNextPage();
    }
    return array_shift($this->currentPageOfResults);
}
```


There might also be interleaved code which is passed in from the application - i.e. code written by Beginner Bob or Legacy Les. For instance, an implementation of the PSR-3 LoggerInterface, which might be referenced inside the fetchNextPage() method which is being run asynchronously.


[P.S. Reminder: place your reply _below_ an edited quote, not _above_.]


-- 
Rowan Tommins
[IMSoP]
--------------NcxKpzCR3u6aZmg4nAQjBWVG--