Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128884 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 380EF1ADB14 for ; Tue, 21 Oct 2025 15:11:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1761059488; bh=1bUnLC9T2jpnRf1kI6yAF1BUdTSpGPnBUmDjybazyA0=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=h1HyWhM67sY7umtgLVcpUt3WdW6s7cZ6PJLL8mxmDDfQJz7485gIcsg2IugfzmCPp I5Ndms9qH+Fhr4XruVPty7G6MGizFFJgxiKrqpqljDodJ2P2w7KAdL2svOFv3Loecv VurPJ6Uq7zkBZF9s8Zgm9FN4sNvuTHEIbbpfQ3J/HjSwax05dWqu5uxpYr4rtZkknx A3s06HT32YO8dssup69zRTYtCZ3SYowjwqnx0pkO+yzFVoBcjZ2oU2CcwHP5/g8mCM e+zK+zH+4dMncZJiXLjFuDGy3lmM7OeoGz8YxEKdPlU+PxBLnU/g07H4gDvGURuhMB 5og4I6tf0WBFw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C01C41804B0 for ; Tue, 21 Oct 2025 15:11:26 +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:19 +0000 (UTC) Received: from smtpclient.apple (unknown [10.0.1.100]) by trowski.net (Postfix) with ESMTPSA id 3D17329BC8F5; Tue, 21 Oct 2025 10:11:09 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/simple; d=trowski.com; s=mail; t=1761059469; bh=q8DZjXBcZMHTsRr6wefbCCAUPeQ=; h=From:Subject:Date:In-Reply-To:Cc:To:References; b=g4+h+xNmsh7B1Vx3U6J/Qa9DkkXQG3THoBMb+lbioxa1aAI8dz1ValrXt1aaI+spp Bu5evXWIYL1A0+jeW0B1vfl/oDPKh/oMtV1QNT8qRtbD0fCu185lYqImLDEoXI/ET3 MtMPl5ubY0MoDgwfTueWzRx6LKssFviTFWqkhn9+OWF+aTh2VPJDgRcp3IbBkP6H/a a6tDl6/yN+st6xNrhgDAraswVFQyvqMgw8//fdo7y6IJNZ78vtSSlkaLC0aNWeNr5H Q94+BN9KFh67A0v3jj/9BAE9I1op/8rGnxFonBHAf2OVx5dwZz+P2U5h9t/7zzTJuq grJqiiEF4m5vw== Message-ID: <3CF9616C-AD20-42C5-A16A-AB9089B8F79F@TROWSKI.COM> Content-Type: multipart/alternative; boundary="Apple-Mail=_B0526B09-AC47-4314-8143-4FB400AF5B65" 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:10:46 -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=_B0526B09-AC47-4314-8143-4FB400AF5B65 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=_B0526B09-AC47-4314-8143-4FB400AF5B65 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=_B0526B09-AC47-4314-8143-4FB400AF5B65--