Re: PHP True Async RFC - Stage 2

From: Date: Thu, 20 Mar 2025 18:28:50 +0000
Subject: Re: PHP True Async RFC - Stage 2
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
>>
>>  This example highlights one of the concerns I have with fibers and this
approach in general. That example will still execute synchronously, taking
file_get_contents() * 3, even though it is in a coroutine function.
>>

>Is that really a problem? If a programmer wrote the code $x = 1 / 0,
then the issue is definitely not with the division operation.

It is a problem. IO file operations are async on linux. You have to
manually type the sync command to be sure if you copy something
to another drive. So having a file_get_contents x3 will surely be executed
but file_put_contents will delay

On Thu, Mar 20, 2025 at 7:57 PM Larry Garfield <[email protected]>
wrote:

> On Thu, Mar 20, 2025, at 2:06 AM, Edmond Dantes wrote:
> > This is simply a wonderful explanation. I will be able to go through
> each point.
> >
> > But before that, let's recall what spawn essentially is.
> > Spawn is an operation that creates a separate execution context and
> > then calls a function within it.
> > To perform this, spawn requires two things:
> > 1. **callable** – something that can be called; this is an expression
> > or the result of an expression.
> > 2. **argument list** – a list of arguments.
>
> Nitpick to make sure we're talking about the same thing: What does
> "Separate execution context" mean here?  Because a keyword whose
> description includes "and" is always a yellow flag at least.  (See also:
> readonly.)  One thing should not do two things.  Unless what you mean here
> is it creates a logical coroutine, within the current async scope.
>
> (I suspect this level of nitpickiness is where the confusion between us
> lies.)
>
> --Larry Garfield
>


-- 
Iliya Miroslavov Iliev
[email protected]


Thread (59 messages)