Re: PHP True Async RFC

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: Re: PHP True Async RFC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Mar 8, 2025 9:29:15 AM Edmond Dantes <[email protected]>:

>> 
>>for($i = 0; $i < 10; $i++) $results[] = async\async(fn($f) => file_get_contents($f),
>> $file[$i]);
>> // convert $results into futures somehow -- though actually doesn't look like it is
>> possible.
>> $results = async\awaitAll($results);
>>
>
> And this semantics can be simplified to:  
> ``async file_get_contents($file[$i]);``
> or
> ``spawn file_get_contents($file[$i]);``
>
> From this perspective, I like that any function can be called with *spawn/async* without
> worrying about its internals or modifying its code. The pros and cons of this approach are well
> known.  

Loving this.

One might even consider to use the go keyaord along with async/spawn, to more easily associate the
operation with go's (gc)oroutines...

Regards,
Daniil Gentili.


Thread (110 messages)

« previous php.internals (#126643) next »