Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128883 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 875A51A00BC for ; Tue, 21 Oct 2025 15:11:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1761059482; bh=MloRtQVg2s6ChoFrs/BHYOfOqpC2cGGBoHgcI6nwCvE=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=akroQiBWS5vRQQ23oA+bwA66zICMR+Bepe41t8qSZd57/K84h4JPDTOU5f6mjlaBC JHyd4IE8H/KrA81eVjhEx0J56EOPw0X2O8fLvlmsSb7xPCndT8HKvUVbBvT5b/hyAu igD3OfExSEZPXqqvccAiSPdyOqY0AzFBtycUp7n5z5iKuX2YnX2RyBBsH5qQRmRj1R uNVoQmgGLkr3hlUl+8ArjAiLcGXpXqtvd5ElquG7MtV7YZKBJBMu3UtkER68byskRG enktljzAM9XikRq+ZcnSWqxn2sk6ZLfPKMdcsN6bRz9voUkymuzjEKhn0bXkcc+qQK KmWqlm5MvSZ7w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 242261801EE for ; Tue, 21 Oct 2025 15:11:20 +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.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from trowski.net (trowski.net [162.213.173.168]) (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, 21 Oct 2025 15:11:14 +0000 (UTC) Received: from smtpclient.apple (unknown [10.0.1.100]) by trowski.net (Postfix) with ESMTPSA id 060A829BC8F4; Tue, 21 Oct 2025 10:10:18 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/simple; d=trowski.com; s=mail; t=1761059469; bh=VnCKN9C6QAQ6d6VEV70huCP+/Do=; h=From:Subject:Date:In-Reply-To:Cc:To:References; b=qUbf4pcf3eYvSrkf9hiF0+3x0dqFVjUY1R+/lZqCkfxhqlSFyer5kUNWiTA/Lq8Wg HflTQ5fK22vD/QsAvlE+CMyEzNqCSW0n/XI8pVlkQYPtOxysKIxqhLupO0lUe+GlIK VDcpelkO6Jt5/90nAYlfd3qwRRkwHFCwtmf+Cxfq0xxoLaTwcNDJTY+tfssdwxXjOW l/r+elO3vLtzT84tlAVD5dDT2RWxVK3VS/t4jwens4mwE3+/Rh82/pzgo+4CAzHJur YQ/7mLbl5G4ieG+6Yq9nIWCMOP0or9bckFKIj6rJdU/ceZu+ARPGM508lwnW0E2Baw HRhS8O6CIHtvQ== Message-ID: Content-Type: multipart/alternative; boundary="Apple-Mail=_FB180130-C604-42B2-8B1F-285A3E3C42F2" 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\)) Subject: Re: [PHP-DEV] PHP True Async RFC Stage 4 Date: Tue, 21 Oct 2025 10:08:55 -0500 In-Reply-To: Cc: Rob Landers , PHP Internals To: Edmond Dantes References: <0e4e39d6-9cc9-4970-92e0-2463143b4011@app.fastmail.com> X-Mailer: Apple Mail (2.3826.700.81) From: aaron@trowski.com (Aaron Piotrowski) --Apple-Mail=_FB180130-C604-42B2-8B1F-285A3E3C42F2 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Oct 21, 2025, at 9:56=E2=80=AFAM, Edmond Dantes = wrote: >=20 >> This seems a bit contradictory and confuses things. When I await(), = do I need to do it in a loop, or just once? >> It might be a good idea to make a couple subtypes: Signal and Future. = Coroutines become Future that only await once, while Signal is something = that can be awaited many times. >=20 > I made a mistake in my previous response, and it requires = clarification. > Classes that can be awaited multiple times are indeed possible. > These include `TimeInterval`, `Channel`, `FileSystemEvent`, as well as > I/O triggers. >=20 > All of these classes can be `Awaitable`. > This is done to allow bulk waiting on objects, regardless of how they > work internally. > So this is meant for functions like `awaitXX`, although such behavior > is also possible for the `await()` function itself: >=20 > ```php > $timeInterval =3D new Async\TimeInterval(1000); > while(true) { > await($timeInterval); > } > ``` >=20 > As for objects of type `Future`, it=E2=80=99s clear that in future = RFCs there > will be a `FutureInterface`, which will be implemented by coroutines. Hi Edmond, I've been meaning to review your RFC and implementation for some time, = but for various reasons, I still haven't been able to give it a thorough = read and review. I noticed this portion of the discussion and wanted to drop a note now, = rather than waiting until I was able to read the entire RFC. Awaitables should always represent a single value. Awaiting multiple = times should never result in a different value. Async sets of values should use a different abstraction to represent a = set. rxjs Observables (rxjs.dev) are on example. AMPHP has a pipeline = library, https://github.com/amphp/pipeline, which defines a = ConcurrentIterator interface. The latter IMO is more appropriate for PHP = + fibers. I recommend having a look at how Future and ConcurrentIterator = are used within AMPHP libraries. I think you should consider additional time beyond only two more weeks = for discussion of this RFC before bringing it to a vote. PHP 8.6 or 9 is = some time away. This is definitely not an RFC to rush to voting. Cheers, Aaron Piotrowski= --Apple-Mail=_FB180130-C604-42B2-8B1F-285A3E3C42F2 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
On Oct 21, = 2025, at 9:56=E2=80=AFAM, Edmond Dantes <edmond.ht@gmail.com> = wrote:

This seems a bit contradictory and confuses things. When I = await(), do I need to do it in a loop, or just once?
It might be a = good idea to make a couple subtypes: Signal and Future. Coroutines = become Future that only await once, while Signal is something that can = be awaited many times.

I made a mistake in my = previous response, and it requires clarification.
Classes that can be = awaited multiple times are indeed possible.
These include = `TimeInterval`, `Channel`, `FileSystemEvent`, as well as
I/O = triggers.

All of these classes can be `Awaitable`.
This is = done to allow bulk waiting on objects, regardless of how they
work = internally.
So this is meant for functions like `awaitXX`, although = such behavior
is also possible for the `await()` function = itself:

```php
$timeInterval =3D new = Async\TimeInterval(1000);
while(true) {
=    await($timeInterval);
}
```

As for = objects of type `Future`, it=E2=80=99s clear that in future RFCs = there
will be a `FutureInterface`, which will be implemented by = coroutines.

Hi = Edmond,

I've been meaning to review your RFC = and implementation for some time, but for various reasons, I still = haven't been able to give it a thorough read and = review.

I noticed this portion of the = discussion and wanted to drop a note now, rather than waiting until I = was able to read the entire RFC.

Awaitables = should always represent a single value. Awaiting multiple times should = never result in a different value.

Async sets = of values should use a different abstraction to represent a set. rxjs = Observables (rxjs.dev) are on example. AMPHP has a pipeline library, https://github.com/amphp/pipeli= ne, which defines a ConcurrentIterator interface. The latter IMO is = more appropriate for PHP + fibers. I recommend having a look at how = Future and ConcurrentIterator are used within AMPHP = libraries.

I think you should consider = additional time beyond only two more weeks for discussion of this RFC = before bringing it to a vote. PHP 8.6 or 9 is some time away. This is = definitely not an RFC to rush to = voting.

Cheers,
Aaron = Piotrowski
= --Apple-Mail=_FB180130-C604-42B2-8B1F-285A3E3C42F2--