> On Oct 21, 2025, at 9:56 AM, Edmond Dantes <[email protected]> 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 = new Async\TimeInterval(1000);
> while(true) {
>    await($timeInterval);
> }
> ```
> 
> As for objects of type `Future`, it’s 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

Reply via email to